From c3a0c0c45198bad7e8fbfb191cf8c3527f41e7bb Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 23 Jan 2016 20:32:53 +0000 Subject: [PATCH] swift: Fix upload from unprivileged user - fixes #273 --- swift/swift.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/swift/swift.go b/swift/swift.go index 1241b70db..3c6dbbaf3 100644 --- a/swift/swift.go +++ b/swift/swift.go @@ -382,7 +382,16 @@ func (f *Fs) Put(in io.Reader, remote string, modTime time.Time, size int64) (fs // Mkdir creates the container if it doesn't exist func (f *Fs) Mkdir() error { - return f.c.ContainerCreate(f.container, nil) + // Check to see if container exists first + _, _, err := f.c.Container(f.container) + if err == nil { + return nil + } + if err == swift.ContainerNotFound { + return f.c.ContainerCreate(f.container, nil) + } + return err + } // Rmdir deletes the container if the fs is at the root