From a91ddbeddc612ea6c0d920cd04050e843d1be495 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 27 Oct 2026 12:04:01 +0000 Subject: [PATCH] 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. --- backend/jottacloud/jottacloud.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/jottacloud/jottacloud.go b/backend/jottacloud/jottacloud.go index a67a02bfb..2659fca2a 100644 --- a/backend/jottacloud/jottacloud.go +++ b/backend/jottacloud/jottacloud.go @@ -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) }