swift: Fix upload from unprivileged user - fixes #273

This commit is contained in:
Nick Craig-Wood 2016-01-23 20:32:53 +00:00
parent 6cb0de43ce
commit c3a0c0c451
1 changed files with 10 additions and 1 deletions

View File

@ -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