Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

dropbox: Fix mkdir on already created directory

Nick Craig-Woodb185e104edd2
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
}