Commit 071de3f 1 parent 3c8eb53 commit 071de3f Copy full SHA for 071de3f
File tree 1 file changed +10
-2
lines changed
application/library/cloudbackup
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,12 @@ func (c *Cloudbackup) OnDelete(file string) {
113
113
if ! c .Filter (file ) {
114
114
return
115
115
}
116
+ relPath := strings .TrimPrefix (file , c .SourcePath )
117
+ if len (relPath ) == 0 || relPath == `/` || relPath == `\` {
118
+ return
119
+ }
116
120
startTime := time .Now ()
117
- objectName := path .Join (c .DestPath , strings . TrimPrefix ( file , c . SourcePath ) )
121
+ objectName := path .Join (c .DestPath , relPath )
118
122
err := c .mgr .RemoveDir (context .Background (), objectName )
119
123
if err != nil {
120
124
log .Error (file + `: ` + err .Error ())
@@ -133,8 +137,12 @@ func (c *Cloudbackup) OnRename(file string) {
133
137
if ! c .Filter (file ) {
134
138
return
135
139
}
140
+ relPath := strings .TrimPrefix (file , c .SourcePath )
141
+ if len (relPath ) == 0 || relPath == `/` || relPath == `\` {
142
+ return
143
+ }
136
144
startTime := time .Now ()
137
- objectName := path .Join (c .DestPath , strings . TrimPrefix ( file , c . SourcePath ) )
145
+ objectName := path .Join (c .DestPath , relPath )
138
146
err := c .mgr .RemoveDir (context .Background (), objectName )
139
147
if err != nil {
140
148
log .Error (file + `: ` + err .Error ())
You can’t perform that action at this time.
0 commit comments