Skip to content

Commit

Permalink
Undo oldParent change on rename errors correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Sep 16, 2021
1 parent c137c8f commit 7e5c42e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,12 @@ func (inode *Inode) SendUpload() bool {
var unmoveName string
if err != nil {
log.Errorf("Error renaming object from %v to %v: %v", from, key, err)
unmoveParent = inode.oldParent
unmoveName = inode.oldName
inode.oldParent = oldParent
inode.oldName = oldName
if inode.oldParent != oldParent || inode.oldName != oldName {
unmoveParent = inode.oldParent
unmoveName = inode.oldName
inode.oldParent = oldParent
inode.oldName = oldName
}
} else {
if inode.oldParent == oldParent && inode.oldName == oldName {
inode.oldParent = nil
Expand Down

0 comments on commit 7e5c42e

Please sign in to comment.