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: list the container to see if it exists #2118

Nick Craig-Wood72392a2d726b
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index 05a2238b7..a6946724e 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -573,10 +573,19 @@ func (f *Fs) Mkdir(dir string) error {
if f.containerOK {
return nil
}
+ // List the container to see if it exists
+ err := f.list("", false, 1, func(remote string, object *storage.Blob, isDirectory bool) error {
+ return nil
+ })
+ if err == nil {
+ f.markContainerOK()
+ return nil
+ }
+ // now try to create the container
options := storage.CreateContainerOptions{
Access: storage.ContainerAccessTypePrivate,
}
- err := f.pacer.Call(func() (bool, error) {
+ err = f.pacer.Call(func() (bool, error) {
err := f.cc.Create(&options)
if err != nil {
if storageErr, ok := err.(storage.AzureStorageServiceError); ok {