dropbox: Fix mkdir on already created directory

This commit is contained in:
Nick Craig-Wood 2014-07-13 10:51:47 +01:00
parent e57a4c7c0c
commit b185e104ed

View File

@ -343,7 +343,14 @@ func (f *FsDropbox) Put(in io.Reader, remote string, modTime time.Time, size int
// Mkdir creates the container if it doesn't exist // Mkdir creates the container if it doesn't exist
func (f *FsDropbox) Mkdir() error { func (f *FsDropbox) Mkdir() error {
_, err := f.db.CreateFolder(f.slashRoot) entry, err := f.db.Metadata(f.slashRoot, false, false, "", "", metadataLimit)
if err == nil {
if entry.IsDir {
return nil
}
return fmt.Errorf("%q already exists as file", f.root)
}
_, err = f.db.CreateFolder(f.slashRoot)
return err return err
} }