From 7511b6f4f1360ff7e6a8c94d7099ce6093e2119e Mon Sep 17 00:00:00 2001 From: Jeffrey Tolar Date: Sat, 24 Apr 2021 15:37:14 -0500 Subject: [PATCH] b2: don't include the bucket name in public link file prefixes Including the bucket name as part of the `fileNamePrefix` passed to `b2_get_download_authorization` results in a link valid for objects that have the bucket name as part of the object path; e.g., rclone link :b2:some-bucket/some-file would result in a public link valid for the object `some-bucket/some-file` in the `some-bucket` bucket (in rclone-remote parlance, `:b2:some-bucket/some-bucket/some-file`). This will almost certainly result in a broken link. The B2 docs don't explicitly specify this behavior, but the example given for `fileNamePrefix` provides some clarification. See https://www.backblaze.com/b2/docs/b2_get_download_authorization.html. --- backend/b2/b2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/b2/b2.go b/backend/b2/b2.go index eccb06441..5d5555602 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -1353,7 +1353,7 @@ func (f *Fs) getDownloadAuthorization(ctx context.Context, bucket, remote string } var request = api.GetDownloadAuthorizationRequest{ BucketID: bucketID, - FileNamePrefix: f.opt.Enc.FromStandardPath(path.Join(f.root, remote)), + FileNamePrefix: f.opt.Enc.FromStandardPath(path.Join(f.rootDirectory, remote)), ValidDurationInSeconds: validDurationInSeconds, } var response api.GetDownloadAuthorizationResponse