Skip to content

fix: encode plus # url with %2B #2094

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 28, 2025
Merged

fix: encode plus # url with %2B #2094

merged 1 commit into from
Apr 28, 2025

Conversation

ldetmer
Copy link
Contributor

@ldetmer ldetmer commented Apr 18, 2025

Currently we are not encoding + signs if it part of the URL path, while this is to spec

Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
reserved characters used for their reserved purposes may be used
unencoded within a URL.

It MAY be encoded.

Originally we did encode plus signs, but inappropriately as a space (%20). This was fixed in this PR . However the fix did 2 things, it stopped treating the + sign as a space, but it also stopped encoding it at all. Technically it only need the first fix here. Removing encoding of the + sign caused several APIs to stop working (spreadsheets and gmail).

So this fix is to bring back converting + signs, however due to the original fix, it now converts them correctly to %2B (+), not %20 (space)

Note we still do NOT want + signs to be encoded for SAFEPATHCHARS_URLENCODER, as we still want to utilize it for reserved expansions See issue

Tested: gmail apiary, sheets apiary, storage apiary and gapic

Fixes #20415
Fixes #1573

@ldetmer ldetmer requested a review from a team as a code owner April 18, 2025 14:33
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Apr 18, 2025
@ldetmer ldetmer requested a review from diegomarquezp April 18, 2025 14:43
@ldetmer ldetmer merged commit 1f8aca7 into main Apr 28, 2025
21 of 22 checks passed
@ldetmer ldetmer deleted the fix-encode-plus branch April 28, 2025 14:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants