dropbox: save an API request when at the root
Before this change, rclone always emitted an API request to discover what type of thing the root is. This is unecessary as it is always a directory.
This commit is contained in:
parent
421e840e37
commit
caa2b8bf40
1 changed files with 10 additions and 8 deletions
|
@ -566,6 +566,7 @@ 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
|
||||
if f.root != "" {
|
||||
_, err = f.getFileMetadata(ctx, f.slashRoot)
|
||||
if err == nil {
|
||||
newRoot := path.Dir(f.root)
|
||||
|
@ -576,6 +577,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
|||
// return an error with an fs which points to the parent
|
||||
return f, fs.ErrorIsFile
|
||||
}
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue