Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.8.1
-
None
-
None
-
Patch
Description
There is a bug in URLHelper.parseQueryString() when dealing with keys in a query string that are URL Encoded.
Example:
UrlHelper.parseQueryString("a%3Ca=1") returns a map
. Note, the key is still URL Encoded.
The problem becomes apparent if you use <s:url> with includeParams="all", which will grab parameters from both the query string and request parameterMap to include into a URL.
Example:
Request URL: /myAction.action?a<a=1
Generated URL by <s:url>: /myAction.action?a<a=1&a%3Ca=1
Expected URL: /myAction.action?a%3Ca=1
Note how "a<a" exists two times in the <s:url> URL, one encoded and one decoded. "a<a" is grabbed from the parameterMap where the servlet container will automatically decode the key. "a%3Ca" is grabbed from the query string by the UrlHelper.parseQueryString (who doesn't decode the key).
The fix is relatively simple (see patch)... I think parseQueryString just needs to call translatedAndDecode on the parameter name.