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
}
This commit is contained in:
Alishan Ladhani 2023-09-02 13:31:14 -04:00 committed by GitHub
parent 85c29e3629
commit 7821cb884d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {