Repository navigation
LDEV-6699 decodeFromURL(): keep a % that is not a valid escape instead of throwing - #20
Merged
Merged
Conversation
…d of throwing decodeURL used Canonicalize.decode(), whose reflective call into Lucee's URLDecoder always failed and fell back to java.net.URLDecoder, which throws on a bare %. It now uses the lenient Canonicalize.decodePercent() from LDEV-4743 after turning + into a space (form decoding as before; %2B still decodes to +). The now unused Canonicalize.decode() is removed.
michaeloffner
approved these changes
Oct 23, 2026
Merged
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.
https://luceeserver.atlassian.net/browse/LDEV-6699 (follow-up to LDEV-4743 / #19)
decodeFromURL()(andguardDecode("url", …)) threwIllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern/Incomplete trailing escape (%) patternfor any%that does not start a valid escape, e.g.decodeFromURL("100%").Cause:
GuardDecode.decodeURLusedCanonicalize.decode(), whose reflective call into Lucee'sURLDecoderalways fails (callMethodon aClassinstead of a static call), so it fell back to the strictjava.net.URLDecoder.Fix:
decodeURLnow uses the lenientCanonicalize.decodePercent()added in LDEV-4743 canonicalize(): keep a % that is not a valid escape instead of throwing #19 (now on master): valid%XXescapes (UTF-8) are decoded and any other%is kept as is.+is still decoded to a space, as before (form decoding). It is replaced before the percent decoding, so%2Bstill decodes to+.Canonicalize.decode()and its broken reflection are removed.Tests:
tests/LDEV6699.cfc(labelguard): trailing%,%followed by non-hex, mixed valid escapes and bare%, UTF-8 (€),+/%2B, and anencodeForURL()round trip.DecodeFromURL,ESAPIDecodeandLDEV4743specs still pass.Based on current master (after #19 was merged).