b2: fix app key support on upload to a bucket - fixes #2428

This commit is contained in:
Nick Craig-Wood 2018-08-18 19:05:32 +01:00
parent 41f709e13b
commit 7c911bf2d6

View File

@ -318,6 +318,11 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to authorize account") return nil, errors.Wrap(err, "failed to authorize account")
} }
// If this is a key limited to a single bucket, it must exist already
if f.bucket != "" && f.info.Allowed.BucketID != "" {
f.markBucketOK()
f.setBucketID(f.info.Allowed.BucketID)
}
if f.root != "" { if f.root != "" {
f.root += "/" f.root += "/"
// Check to see if the (bucket,directory) is actually an existing file // Check to see if the (bucket,directory) is actually an existing file