From f2e693f722fba85c5a9865767d29689295fe0800 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 11 Apr 2024 16:08:29 +0100 Subject: [PATCH] sync: fix case normalisation on s3 Before this change when the sync routine attempted to normalise a case, say from "FiLe.txt" to "file.txt" this caused a 400 Bad Request error: > This copy request is illegal because it is trying to copy an object > to itself without changing the object's metadata, storage class, > website redirect location or encryption attributes. This was caused by passing the same object as the source and destination to the move routine, whereas the destination object had a different case and didn't exist, so should have been passed as nil. See: https://github.com/rclone/rclone/pull/7743#discussion_r1557345906 --- fs/sync/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/sync/sync.go b/fs/sync/sync.go index 5422927e5..8974ca845 100644 --- a/fs/sync/sync.go +++ b/fs/sync/sync.go @@ -386,7 +386,7 @@ func (s *syncCopyMove) pairChecker(in *pipe, out *pipe, fraction int, wg *sync.W } // Fix case for case insensitive filesystems if s.ci.FixCase && !s.ci.Immutable && src.Remote() != pair.Dst.Remote() { - if newDst, err := operations.Move(s.ctx, s.fdst, pair.Dst, src.Remote(), pair.Dst); err != nil { + if newDst, err := operations.Move(s.ctx, s.fdst, nil, src.Remote(), pair.Dst); err != nil { fs.Errorf(pair.Dst, "Error while attempting to rename to %s: %v", src.Remote(), err) s.processError(err) } else {