forked from TrueCloudLab/rclone
Check if swift segments container exists before create
Avoids blindly trying to create the segments container, which can fail if the authentication credentials don't allow container creates or updates. Fixes #1769
This commit is contained in:
parent
fafaea7edc
commit
1602a3a055
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue