forked from TrueCloudLab/rclone
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:
parent
b062ae9d13
commit
72392a2d72
1 changed files with 10 additions and 1 deletions
|
@ -573,10 +573,19 @@ func (f *Fs) Mkdir(dir string) error {
|
||||||
if f.containerOK {
|
if f.containerOK {
|
||||||
return nil
|
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{
|
options := storage.CreateContainerOptions{
|
||||||
Access: storage.ContainerAccessTypePrivate,
|
Access: storage.ContainerAccessTypePrivate,
|
||||||
}
|
}
|
||||||
err := f.pacer.Call(func() (bool, error) {
|
err = f.pacer.Call(func() (bool, error) {
|
||||||
err := f.cc.Create(&options)
|
err := f.cc.Create(&options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if storageErr, ok := err.(storage.AzureStorageServiceError); ok {
|
if storageErr, ok := err.(storage.AzureStorageServiceError); ok {
|
||||||
|
|
Loading…
Add table
Reference in a new issue