"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
operations: fix case- or Unicode-only renames deleting the file
nielasha22df73dec64
diff --git a/fs/operations/operations.go b/fs/operations/operations.goindex 089664850..52ace4f25 100644--- a/fs/operations/operations.go+++ b/fs/operations/operations.go@@ -509,6 +509,9 @@ func move(ctx context.Context, fdst fs.Fs, dst fs.Object, remote string, src fs.}}// Move not found or didn't work so copy dst <- src+ if SameConfig(src.Fs(), fdst) && needsMoveCaseInsensitive(fdst, fdst, remote, src.Remote(), false) {+ return MoveCaseInsensitive(ctx, fdst, fdst, origRemote, src.Remote(), false, src)+ }if origRemote != remote {dst = nil}diff --git a/fs/operations/operations_test.go b/fs/operations/operations_test.goindex 61438978f..3a397721d 100644--- a/fs/operations/operations_test.go+++ b/fs/operations/operations_test.go@@ -49,6 +49,7 @@ import ("github.com/stretchr/testify/require""golang.org/x/text/cases""golang.org/x/text/language"+ "golang.org/x/text/unicode/norm")// Some times used in the tests@@ -1136,6 +1137,41 @@ func TestCaseInsensitiveMoveFile(t *testing.T) {r.CheckRemoteItems(t, file2Capitalized)}+func TestMoveUnicodeEquivalentWithoutServerSideMove(t *testing.T) {+ ctx := context.Background()+ r := fstest.NewRunIndividual(t)+ r.Fremote.Features().Disable("Move")++ nfd := norm.NFD.String("sub/équivalent.txt")+ nfc := norm.NFC.String("sub/équivalent.txt")+ file1 := r.WriteObject(ctx, nfd, "file1 contents", t1)+ src, err := r.Fremote.NewObject(ctx, nfd)+ require.NoError(t, err)++ _, err = operations.Move(ctx, r.Fremote, nil, nfc, src)+ require.NoError(t, err)+ file1.Path = nfc+ r.CheckRemoteItems(t, file1)+}++func TestCaseInsensitiveMoveWithoutServerSideMove(t *testing.T) {+ ctx := context.Background()+ r := fstest.NewRunIndividual(t)+ if !r.Fremote.Features().CaseInsensitive {+ t.Skip("remote is case sensitive")+ }+ r.Fremote.Features().Disable("Move")++ file1 := r.WriteObject(ctx, "sub/file1", "file1 contents", t1)+ src, err := r.Fremote.NewObject(ctx, "sub/file1")+ require.NoError(t, err)++ _, err = operations.Move(ctx, r.Fremote, nil, "sub/File1", src)+ require.NoError(t, err)+ file1.Path = "sub/File1"+ r.CheckRemoteItems(t, file1)+}+func TestCaseInsensitiveMoveFileDryRun(t *testing.T) {ctx := context.Background()ctx, ci := fs.AddConfig(ctx)