Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Oct 31, 2023
1 parent 3c8eb53 commit 071de3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions application/library/cloudbackup/cloudbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ func (c *Cloudbackup) OnDelete(file string) {
if !c.Filter(file) {
return
}
relPath := strings.TrimPrefix(file, c.SourcePath)
if len(relPath) == 0 || relPath == `/` || relPath == `\` {
return
}
startTime := time.Now()
objectName := path.Join(c.DestPath, strings.TrimPrefix(file, c.SourcePath))
objectName := path.Join(c.DestPath, relPath)
err := c.mgr.RemoveDir(context.Background(), objectName)
if err != nil {
log.Error(file + `: ` + err.Error())
Expand All @@ -133,8 +137,12 @@ func (c *Cloudbackup) OnRename(file string) {
if !c.Filter(file) {
return
}
relPath := strings.TrimPrefix(file, c.SourcePath)
if len(relPath) == 0 || relPath == `/` || relPath == `\` {
return
}
startTime := time.Now()
objectName := path.Join(c.DestPath, strings.TrimPrefix(file, c.SourcePath))
objectName := path.Join(c.DestPath, relPath)
err := c.mgr.RemoveDir(context.Background(), objectName)
if err != nil {
log.Error(file + `: ` + err.Error())
Expand Down

0 comments on commit 071de3f

Please sign in to comment.