mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 03:17:28 +08:00
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
|
@ -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…
Reference in New Issue
Block a user