"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
azureblob: add support for `x-ms-tags` header
Trevor Starick87eaf3762984
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.goindex 6b5cace0c..936b75d0f 100644--- a/backend/azureblob/azureblob.go+++ b/backend/azureblob/azureblob.go@@ -519,6 +519,7 @@ type Object struct {mimeType string // Content-Type of the objectaccessTier blob.AccessTier // Blob Access Tiermeta map[string]string // blob metadata - take metadataMu when accessing+ tags map[string]string // blob tags}// ------------------------------------------------------------@@ -1876,6 +1877,14 @@ func (o *Object) decodeMetaDataFromBlob(info *container.BlobItem) (err error) {return nil}+func (o *Object) getTags() (tags map[string]string) {+ if o.tags != nil {+ return o.tags+ }++ return map[string]string{}+}+// getBlobSVC creates a blob clientfunc (o *Object) getBlobSVC() *blob.Client {container, directory := o.split()@@ -2229,6 +2238,7 @@ func (w *azChunkWriter) Close(ctx context.Context) (err error) {options := blockblob.CommitBlockListOptions{Metadata: w.o.getMetadata(),+ Tags: w.o.getTags(),Tier: parseTier(w.f.opt.AccessTier),HTTPHeaders: &w.ui.httpHeaders,}@@ -2284,6 +2294,7 @@ func (o *Object) uploadSinglepart(ctx context.Context, in io.Reader, size int64,options := blockblob.UploadOptions{Metadata: o.getMetadata(),+ Tags: o.getTags(),Tier: parseTier(o.fs.opt.AccessTier),HTTPHeaders: &ui.httpHeaders,}@@ -2354,6 +2365,20 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [switch lowerKey {case "":// ignore+ case "x-ms-tags":+ if o.tags == nil {+ o.tags = make(map[string]string)+ }++ tags := strings.Split(value, ",")+ for _, tag := range tags {+ parts := strings.SplitN(tag, "=", 2)+ if len(parts) != 2 {+ return ui, fmt.Errorf("invalid tag %q", tag)+ }++ o.tags[parts[0]] = parts[1]+ }case "cache-control":ui.httpHeaders.BlobCacheControl = pString(value)case "content-disposition":diff --git a/docs/content/azureblob.md b/docs/content/azureblob.mdindex 8d197c831..8f74e072a 100644--- a/docs/content/azureblob.md+++ b/docs/content/azureblob.md@@ -938,8 +938,9 @@ You can set custom upload headers with the `--header-upload` flag.- Content-Encoding- Content-Language- Content-Type+- X-MS-Tags-Eg `--header-upload "Content-Type: text/potato"`+Eg `--header-upload "Content-Type: text/potato"` or `--header-upload "X-MS-Tags: foo=bar"`## Limitations