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: save an API request when at the root

Nick Craig-Woodcaa2b8bf40f1
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.go
index 11436a327..956f6bde1 100644
--- a/backend/dropbox/dropbox.go
+++ b/backend/dropbox/dropbox.go
@@ -566,15 +566,17 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
f.setRoot(root)
// See if the root is actually an object
- _, err = f.getFileMetadata(ctx, f.slashRoot)
- if err == nil {
- newRoot := path.Dir(f.root)
- if newRoot == "." {
- newRoot = ""
+ if f.root != "" {
+ _, err = f.getFileMetadata(ctx, f.slashRoot)
+ if err == nil {
+ newRoot := path.Dir(f.root)
+ if newRoot == "." {
+ newRoot = ""
+ }
+ f.setRoot(newRoot)
+ // return an error with an fs which points to the parent
+ return f, fs.ErrorIsFile
}
- f.setRoot(newRoot)
- // return an error with an fs which points to the parent
- return f, fs.ErrorIsFile
}
return f, nil
}