"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
hubic: don't check the container exists before creating it
Nick Craig-Woode96c5b5f3995
diff --git a/hubic/hubic.go b/hubic/hubic.goindex 0e92455a0..dd3f4f99a 100644--- a/hubic/hubic.go+++ b/hubic/hubic.go@@ -165,7 +165,7 @@ func NewFs(name, root string) (fs.Fs, error) {}// Make inner swift Fs from the connection- swiftFs, err := swift.NewFsWithConnection(name, root, c)+ swiftFs, err := swift.NewFsWithConnection(name, root, c, true)if err != nil && err != fs.ErrorIsFile {return nil, err}diff --git a/swift/swift.go b/swift/swift.goindex c71975e77..cdec9f85d 100644--- a/swift/swift.go+++ b/swift/swift.go@@ -121,6 +121,7 @@ type Fs struct {containerOKMu sync.Mutex // mutex to protect container OKcontainerOK bool // true if we have created the containersegmentsContainer string // container to store the segments (if any) in+ noCheckContainer bool // don't check the container before creating it}// Object describes a swift object@@ -215,8 +216,11 @@ func swiftConnection(name string) (*swift.Connection, error) {}// NewFsWithConnection contstructs an Fs from the path, container:path-// and authenticated connection-func NewFsWithConnection(name, root string, c *swift.Connection) (fs.Fs, error) {+// and authenticated connection.+//+// if noCheckContainer is set then the Fs won't check the container+// exists before creating it.+func NewFsWithConnection(name, root string, c *swift.Connection, noCheckContainer bool) (fs.Fs, error) {container, directory, err := parsePath(root)if err != nil {return nil, err@@ -227,6 +231,7 @@ func NewFsWithConnection(name, root string, c *swift.Connection) (fs.Fs, error)container: container,segmentsContainer: container + "_segments",root: directory,+ noCheckContainer: noCheckContainer,}f.features = (&fs.Features{ReadMimeType: true,@@ -263,7 +268,7 @@ func NewFs(name, root string) (fs.Fs, error) {if err != nil {return nil, err}- return NewFsWithConnection(name, root, c)+ return NewFsWithConnection(name, root, c, false)}// Return an Object from a path@@ -480,7 +485,10 @@ func (f *Fs) Mkdir(dir string) error {return nil}// Check to see if container exists first- _, _, err := f.c.Container(f.container)+ var err error = swift.ContainerNotFound+ if !f.noCheckContainer {+ _, _, err = f.c.Container(f.container)+ }if err == swift.ContainerNotFound {err = f.c.ContainerCreate(f.container, nil)}