"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
memory: fix dst mutating src after server-side copy
nielashfecce67ac66f
diff --git a/backend/memory/memory.go b/backend/memory/memory.goindex 80fc321f9..11c02d78a 100644--- a/backend/memory/memory.go+++ b/backend/memory/memory.go@@ -482,7 +482,8 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,if od == nil {return nil, fs.ErrorObjectNotFound}- buckets.updateObjectData(dstBucket, dstPath, od)+ odCopy := *od+ buckets.updateObjectData(dstBucket, dstPath, &odCopy)return f.NewObject(ctx, remote)}diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex 3e3237f1a..72527a1e4 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -1237,6 +1237,13 @@ func Run(t *testing.T, opt *Opt) {// Check dst lightly - list above has checked ModTime/Hashesassert.Equal(t, file2Copy.Path, dst.Remote())+ // check that mutating dst does not mutate src+ err = dst.SetModTime(ctx, fstest.Time("2004-03-03T04:05:06.499999999Z"))+ if err != fs.ErrorCantSetModTimeWithoutDelete && err != fs.ErrorCantSetModTime {+ assert.NoError(t, err)+ assert.False(t, src.ModTime(ctx).Equal(dst.ModTime(ctx)), "mutating dst should not mutate src -- is it Copying by pointer?")+ }+// Delete copyerr = dst.Remove(ctx)require.NoError(t, err)