mirror of
https://github.com/rclone/rclone.git
synced 2026-10-28 06:18:39 -04:00
jottacloud: fix server-side copy onto a trashed file keeping the old name case
Jottacloud is case insensitive, so a server-side copy to "File1" while "file1" was in the trash restored the trashed file under its old name "file1". The restored file is now renamed to the requested name.
This commit is contained in:
1 parent
b8d4ea09c4
commit
a91ddbeddc
1 file changed
+5
@@ -1518,6 +1518,11 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
// Workaround necessary when destination was a trashed file, to avoid the copied file also being in trash (bug in api?)
|
||||
fs.Debugf(src, "Server-side copied to trashed destination, restoring")
|
||||
info, err = f.createOrUpdate(ctx, remote, createTime, modTime, info.Size, info.MD5)
|
||||
// The restored file keeps the name it was trashed with, which may differ in case
|
||||
if err == nil && info != nil && info.Name != f.opt.Enc.FromStandardName(path.Base(remote)) {
|
||||
fs.Debugf(src, "Renaming restored %q to %q", info.Name, path.Base(remote))
|
||||
info, err = f.copyOrMove(ctx, "mv", f.filePath(remote), remote)
|
||||
}
|
||||
} else if createTimeMeta || modTimeMeta {
|
||||
info, err = f.createOrUpdate(ctx, remote, createTime, modTime, info.Size, info.MD5)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user