You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Sean Ford (JIRA)" <ji...@apache.org> on 2010/03/19 18:40:27 UTC

[jira] Created: (WW-3411) query string decoding error in URLHelper.parseQueryString

query string decoding error in URLHelper.parseQueryString
---------------------------------------------------------

                 Key: WW-3411
                 URL: https://issues.apache.org/jira/browse/WW-3411
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.1.8.1
            Reporter: Sean Ford
         Attachments: URLHelper_parseQueryString_EncodingFix.patch

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 {"a%3Ca" : "1"}. 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&amp;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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-3411) query string decoding error in URLHelper.parseQueryString

Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart resolved WW-3411.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.0
         Assignee: Lukasz Lenart

Patch committed, thanks a lot!

> query string decoding error in URLHelper.parseQueryString
> ---------------------------------------------------------
>
>                 Key: WW-3411
>                 URL: https://issues.apache.org/jira/browse/WW-3411
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.8.1
>            Reporter: Sean Ford
>            Assignee: Lukasz Lenart
>             Fix For: 2.2.0
>
>         Attachments: URLHelper_parseQueryString_EncodingFix.patch
>
>
> 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 {"a%3Ca" : "1"}. 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&amp;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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-3411) query string decoding error in URLHelper.parseQueryString

Posted by "Sean Ford (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Ford updated WW-3411:
--------------------------

    Attachment: URLHelper_parseQueryString_EncodingFix.patch

> query string decoding error in URLHelper.parseQueryString
> ---------------------------------------------------------
>
>                 Key: WW-3411
>                 URL: https://issues.apache.org/jira/browse/WW-3411
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.8.1
>            Reporter: Sean Ford
>         Attachments: URLHelper_parseQueryString_EncodingFix.patch
>
>
> 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 {"a%3Ca" : "1"}. 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&amp;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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.