File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
application/library/cloudbackup Expand file tree Collapse file tree 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) {
113113 if ! c .Filter (file ) {
114114 return
115115 }
116+ relPath := strings .TrimPrefix (file , c .SourcePath )
117+ if len (relPath ) == 0 || relPath == `/` || relPath == `\` {
118+ return
119+ }
116120 startTime := time .Now ()
117- objectName := path .Join (c .DestPath , strings . TrimPrefix ( file , c . SourcePath ) )
121+ objectName := path .Join (c .DestPath , relPath )
118122 err := c .mgr .RemoveDir (context .Background (), objectName )
119123 if err != nil {
120124 log .Error (file + `: ` + err .Error ())
@@ -133,8 +137,12 @@ func (c *Cloudbackup) OnRename(file string) {
133137 if ! c .Filter (file ) {
134138 return
135139 }
140+ relPath := strings .TrimPrefix (file , c .SourcePath )
141+ if len (relPath ) == 0 || relPath == `/` || relPath == `\` {
142+ return
143+ }
136144 startTime := time .Now ()
137- objectName := path .Join (c .DestPath , strings . TrimPrefix ( file , c . SourcePath ) )
145+ objectName := path .Join (c .DestPath , relPath )
138146 err := c .mgr .RemoveDir (context .Background (), objectName )
139147 if err != nil {
140148 log .Error (file + `: ` + err .Error ())
You can’t perform that action at this time.
0 commit comments