forked from TrueCloudLab/rclone
vfs: Fix panic on rename with --dry-run set - fixes #2911
This commit is contained in:
parent
5e5578d2c3
commit
bd11d3cb62
1 changed files with 6 additions and 0 deletions
|
@ -123,6 +123,12 @@ func (f *File) rename(destDir *Dir, newName string) error {
|
||||||
fs.Errorf(f.Path(), "File.Rename error: %v", err)
|
fs.Errorf(f.Path(), "File.Rename error: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// newObject can be nil here for example if --dry-run
|
||||||
|
if newObject == nil {
|
||||||
|
err = errors.New("rename failed: nil object returned")
|
||||||
|
fs.Errorf(f.Path(), "File.Rename %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
// Update the node with the new details
|
// Update the node with the new details
|
||||||
fs.Debugf(f.o, "Updating file with %v %p", newObject, f)
|
fs.Debugf(f.o, "Updating file with %v %p", newObject, f)
|
||||||
// f.rename(destDir, newObject)
|
// f.rename(destDir, newObject)
|
||||||
|
|
Loading…
Reference in a new issue