"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
box: pass options to rest.Opts for uploadPart
Tim Gallant01cb256b84db
diff --git a/backend/box/box.go b/backend/box/box.goindex 60b3160de..e444b9015 100644--- a/backend/box/box.go+++ b/backend/box/box.go@@ -1254,7 +1254,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, opif size <= int64(o.fs.opt.UploadCutoff) {err = o.upload(ctx, in, leaf, directoryID, modTime, options...)} else {- err = o.uploadMultipart(ctx, in, leaf, directoryID, size, modTime)+ err = o.uploadMultipart(ctx, in, leaf, directoryID, size, modTime, options...)}return err}diff --git a/backend/box/upload.go b/backend/box/upload.goindex b832bf1c3..e259740c2 100644--- a/backend/box/upload.go+++ b/backend/box/upload.go@@ -54,7 +54,7 @@ func sha1Digest(digest []byte) string {}// uploadPart uploads a part in an upload session-func (o *Object) uploadPart(ctx context.Context, SessionID string, offset, totalSize int64, chunk []byte, wrap accounting.WrapFn) (response *api.UploadPartResponse, err error) {+func (o *Object) uploadPart(ctx context.Context, SessionID string, offset, totalSize int64, chunk []byte, wrap accounting.WrapFn, options ...fs.OpenOption) (response *api.UploadPartResponse, err error) {chunkSize := int64(len(chunk))sha1sum := sha1.Sum(chunk)opts := rest.Opts{@@ -64,6 +64,7 @@ func (o *Object) uploadPart(ctx context.Context, SessionID string, offset, totalContentType: "application/octet-stream",ContentLength: &chunkSize,ContentRange: fmt.Sprintf("bytes %d-%d/%d", offset, offset+chunkSize-1, totalSize),+ Options: options,ExtraHeaders: map[string]string{"Digest": sha1Digest(sha1sum[:]),},@@ -171,7 +172,7 @@ func (o *Object) abortUpload(ctx context.Context, SessionID string) (err error)}// uploadMultipart uploads a file using multipart upload-func (o *Object) uploadMultipart(ctx context.Context, in io.Reader, leaf, directoryID string, size int64, modTime time.Time) (err error) {+func (o *Object) uploadMultipart(ctx context.Context, in io.Reader, leaf, directoryID string, size int64, modTime time.Time, options ...fs.OpenOption) (err error) {// Create upload sessionsession, err := o.createUploadSession(ctx, leaf, directoryID, size)if err != nil {@@ -236,7 +237,7 @@ outer:defer wg.Done()defer o.fs.uploadToken.Put()fs.Debugf(o, "Uploading part %d/%d offset %v/%v part size %v", part+1, session.TotalParts, fs.SizeSuffix(position), fs.SizeSuffix(size), fs.SizeSuffix(chunkSize))- partResponse, err := o.uploadPart(ctx, session.ID, position, size, buf, wrap)+ partResponse, err := o.uploadPart(ctx, session.ID, position, size, buf, wrap, options...)if err != nil {err = errors.Wrap(err, "multipart upload failed to upload part")select {