mirror of
https://github.com/rclone/rclone
synced 2024-11-24 01:26:25 +01:00
b2: fix failed to create file system with application key limited to a prefix
Before this change, if an application key limited to a prefix was in use, with trailing `/` marking the folders then rclone would HEAD the path without a trailing `/` to work out if it was a file or a folder. This returned a permission denied error, which rclone returned to the user. Failed to create file system for "b2:bucket/path/": failed to HEAD for download: Unknown 401 (401 unknown) This change assumes any errors on HEAD will make rclone assume the object does not exist and the path is referring to a directory. See: https://forum.rclone.org/t/b2-error-on-application-key-limited-to-a-prefix/22159/
This commit is contained in:
parent
edfe183ba2
commit
53aa4b87fd
@ -479,12 +479,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
f.setRoot(newRoot)
|
||||
_, err := f.NewObject(ctx, leaf)
|
||||
if err != nil {
|
||||
if err == fs.ErrorObjectNotFound {
|
||||
// File doesn't exist so return old f
|
||||
f.setRoot(oldRoot)
|
||||
return f, nil
|
||||
}
|
||||
return nil, err
|
||||
// File doesn't exist so return old f
|
||||
f.setRoot(oldRoot)
|
||||
return f, nil
|
||||
}
|
||||
// return an error with an fs which points to the parent
|
||||
return f, fs.ErrorIsFile
|
||||
|
Loading…
Reference in New Issue
Block a user