From b185e104edd26a2386d13c2a09435c8ff96d357d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 13 Jul 2014 10:51:47 +0100 Subject: [PATCH] dropbox: Fix mkdir on already created directory --- dropbox/dropbox.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dropbox/dropbox.go b/dropbox/dropbox.go index a9ab7171b..1e58db398 100644 --- a/dropbox/dropbox.go +++ b/dropbox/dropbox.go @@ -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 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 }