"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
b2: enable server side copy to copy between buckets - fixes #3303
Nick Craig-Woodc9f77719e41e
diff --git a/backend/b2/api/types.go b/backend/b2/api/types.goindex 463545e97..ae1c58858 100644--- a/backend/b2/api/types.go+++ b/backend/b2/api/types.go@@ -329,10 +329,11 @@ type CancelLargeFileResponse struct {// CopyFileRequest is as passed to b2_copy_filetype CopyFileRequest struct {- SourceID string `json:"sourceFileId"` // The ID of the source file being copied.- Name string `json:"fileName"` // The name of the new file being created.- Range string `json:"range,omitempty"` // The range of bytes to copy. If not provided, the whole source file will be copied.- MetadataDirective string `json:"metadataDirective,omitempty"` // The strategy for how to populate metadata for the new file: COPY or REPLACE- ContentType string `json:"contentType,omitempty"` // The MIME type of the content of the file (REPLACE only)- Info map[string]string `json:"fileInfo,omitempty"` // This field stores the metadata that will be stored with the file. (REPLACE only)+ SourceID string `json:"sourceFileId"` // The ID of the source file being copied.+ Name string `json:"fileName"` // The name of the new file being created.+ Range string `json:"range,omitempty"` // The range of bytes to copy. If not provided, the whole source file will be copied.+ MetadataDirective string `json:"metadataDirective,omitempty"` // The strategy for how to populate metadata for the new file: COPY or REPLACE+ ContentType string `json:"contentType,omitempty"` // The MIME type of the content of the file (REPLACE only)+ Info map[string]string `json:"fileInfo,omitempty"` // This field stores the metadata that will be stored with the file. (REPLACE only)+ DestBucketID string `json:"destinationBucketId,omitempty"` // The destination ID of the bucket if set, if not the source bucket will be used}diff --git a/backend/b2/b2.go b/backend/b2/b2.goindex 2d8299fbb..789266a85 100644--- a/backend/b2/b2.go+++ b/backend/b2/b2.go@@ -1147,10 +1147,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,fs.Debugf(src, "Can't copy - not same remote type")return nil, fs.ErrorCantCopy}- srcFs := srcObj.fs- if srcFs.bucket != f.bucket {- fs.Debugf(src, "Can't copy - not same bucket")- return nil, fs.ErrorCantCopy+ destBucketID, err := f.getBucketID()+ if err != nil {+ return nil, err}opts := rest.Opts{Method: "POST",@@ -1160,6 +1159,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,SourceID: srcObj.id,Name: f.root + remote,MetadataDirective: "COPY",+ DestBucketID: destBucketID,}var response api.FileInfoerr = f.pacer.Call(func() (bool, error) {