From 7821cb884d045efd04e6ecb6a0527b3b58b7aace Mon Sep 17 00:00:00 2001 From: Alishan Ladhani <8869764+aladh@users.noreply.github.com> Date: Sat, 2 Sep 2023 13:31:14 -0400 Subject: [PATCH] b2: fix rclone link when object path contains special characters Before this change, b2 would return an error when opening a link generated by `rclone link`. The following error occurs when the object path contains an ampersand that is not percent encoded: { "code": "bad_request", "message": "Bad character in percent-encoded string: 38 (0x26)", "status": 400 } --- 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 56d8ff117..726c8ffa3 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -1426,7 +1426,7 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, if err != nil { return "", err } - absPath := "/" + bucketPath + absPath := "/" + urlEncode(bucketPath) link = RootURL + "/file/" + urlEncode(bucket) + absPath bucketType, err := f.getbucketType(ctx, bucket) if err != nil {