azureblob: list the container to see if it exists #2118

This means that SAS URLs which are tied to a single container will work.
This commit is contained in:
Nick Craig-Wood 2018-06-25 15:15:17 +01:00
parent b062ae9d13
commit 72392a2d72

View File

@ -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 {