fix: handle malformed percent-escapes in Gmail and Calendar URLs - #68
Closed
Ashutosh0x wants to merge 1 commit into
Closed
fix: handle malformed percent-escapes in Gmail and Calendar URLs#68Ashutosh0x wants to merge 1 commit into
Ashutosh0x wants to merge 1 commit into
Conversation
Wrap bare decodeURIComponent calls in the Gmail #search/, #label/, and Calendar URL branches with a safe fallback, so URLs containing a bare %% (e.g. '50%%off') return a friendly error instead of throwing an unhandled URIError. Fixes cloudflare#55
Author
|
I have read the CLA Document and I hereby sign the CLA |
Member
|
Hi @Ashutosh0x, Apologies but, per our contributing guide, we prefer not to receive external pull requests. We prefer instead to receive issue reports, which we can then direct our own agents to solve. Could you please file an issue instead? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55
Problem
Gmail URLs containing a bare %%\ (e.g. \50%%off, \Q1 100%%) throw an unhandled \URIError\ from bare \decodeURIComponent()\ calls in the #search/\ and #label/\ branches. The rest of \getGatekeeperClassFor\ provides friendly errors for bad input, but this path crashes with a raw stack trace.
Fix
Add a \safeDecodeURI\ helper that catches \URIError\ and falls back to the raw string. Applied to the Gmail search, label, and Calendar URL decode sites.
8 insertions, 3 deletions.
cc @jonesphillip @kentonv