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

Check if swift segments container exists before create

John Leach1602a3a05552
diff --git a/swift/swift.go b/swift/swift.go
index c97e5e959..c4312ffb2 100644
--- a/swift/swift.go
+++ b/swift/swift.go
@@ -788,7 +788,11 @@ func urlEncode(str string) string {
// container. It returns a string which prefixes current segments.
func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64, contentType string) (string, error) {
// Create the segmentsContainer if it doesn't exist
- err := o.fs.c.ContainerCreate(o.fs.segmentsContainer, nil)
+ var err error = swift.ContainerNotFound
+ _, _, err = o.fs.c.Container(o.fs.segmentsContainer)
+ if err == swift.ContainerNotFound {
+ err = o.fs.c.ContainerCreate(o.fs.segmentsContainer, nil)
+ }
if err != nil {
return "", err
}