Skip to content

fix: handle malformed percent-escapes in Gmail and Calendar URLs - #68

Closed
Ashutosh0x wants to merge 1 commit into
cloudflare:mainfrom
Ashutosh0x:fix/gmail-bare-percent-urierror
Closed

fix: handle malformed percent-escapes in Gmail and Calendar URLs#68
Ashutosh0x wants to merge 1 commit into
cloudflare:mainfrom
Ashutosh0x:fix/gmail-bare-percent-urierror

Conversation

@Ashutosh0x

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@kentonv

kentonv commented Aug 7, 2026

Copy link
Copy Markdown
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?

@kentonv kentonv closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gmail URLs containing a bare % throw an unhandled URIError when binding a resource

2 participants