Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

azureblob: send nil tier if empty string

Roel Arentsa79db20bcd06
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index fcd1f5fbd..c2df10060 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -1471,9 +1471,8 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
srcBlobSVC := srcObj.getBlobSVC()
srcURL := srcBlobSVC.URL()
- tier := blob.AccessTier(f.opt.AccessTier)
options := blob.StartCopyFromURLOptions{
- Tier: &tier,
+ Tier: parseTier(f.opt.AccessTier),
}
var startCopy blob.StartCopyFromURLResponse
err = f.pacer.Call(func() (bool, error) {
@@ -2045,10 +2044,9 @@ func (o *Object) uploadMultipart(ctx context.Context, in io.Reader, size int64,
return err
}
- tier := blob.AccessTier(o.fs.opt.AccessTier)
options := blockblob.CommitBlockListOptions{
Metadata: o.getMetadata(),
- Tier: &tier,
+ Tier: parseTier(o.fs.opt.AccessTier),
HTTPHeaders: httpHeaders,
}
@@ -2092,10 +2090,9 @@ func (o *Object) uploadSinglepart(ctx context.Context, in io.Reader, size int64,
b := bytes.NewReader(buf[:n])
rs := &readSeekCloser{Reader: b, Seeker: b}
- tier := blob.AccessTier(o.fs.opt.AccessTier)
options := blockblob.UploadOptions{
Metadata: o.getMetadata(),
- Tier: &tier,
+ Tier: parseTier(o.fs.opt.AccessTier),
HTTPHeaders: httpHeaders,
}
@@ -2265,6 +2262,14 @@ func (o *Object) GetTier() string {
return string(o.accessTier)
}
+func parseTier(tier string) *blob.AccessTier {
+ if tier == "" {
+ return nil
+ }
+ msTier := blob.AccessTier(tier)
+ return &msTier
+}
+
// Check the interfaces are satisfied
var (
_ fs.Fs = &Fs{}