"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
dropbox: fix server side copying over existing object
Nick Craig-Woodceea6753eeaa
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.goindex f2f1fc852..520c5dbc2 100644--- a/backend/dropbox/dropbox.go+++ b/backend/dropbox/dropbox.go@@ -47,6 +47,7 @@ import ("github.com/rclone/rclone/fs/config/obscure""github.com/rclone/rclone/fs/fserrors""github.com/rclone/rclone/fs/hash"+ "github.com/rclone/rclone/fs/operations""github.com/rclone/rclone/lib/batcher""github.com/rclone/rclone/lib/encoder""github.com/rclone/rclone/lib/oauthutil"@@ -1020,13 +1021,20 @@ func (f *Fs) Precision() time.Duration {// Will only be called if src.Fs().Name() == f.Name()//// If it isn't possible then return fs.ErrorCantCopy-func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error) {+func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (dst fs.Object, err error) {srcObj, ok := src.(*Object)if !ok {fs.Debugf(src, "Can't copy - not same remote type")return nil, fs.ErrorCantCopy}+ // Find and remove existing object+ cleanup, err := operations.RemoveExisting(ctx, f, remote, "server side copy")+ if err != nil {+ return nil, err+ }+ defer cleanup(&err)+// Temporary Object under constructiondstObj := &Object{fs: f,@@ -1040,7 +1048,6 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,ToPath: f.opt.Enc.FromStandardPath(dstObj.remotePath()),},}- var err errorvar result *files.RelocationResulterr = f.pacer.Call(func() (bool, error) {result, err = f.srv.CopyV2(&arg)