struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Nenning (JIRA)" <>
Subject [jira] [Commented] (WW-4628) Space character and includeParams
Date Mon, 01 Aug 2016 09:37:20 GMT


Christoph Nenning commented on WW-4628:

Recently I had an issue with {{<s:url  includeParams="get" encode="false" />}}, too.
In my case it was also a parameter with spaces. That parameter is already encoded and gets
encoded a 2nd time. That causes problems when generated URL is used.

Creation of URL happens in class {{DefaultUrlHelper}}. The method {{buildParameterSubstring(String
name, String value)}} always encodes name and value, without checking {{encode}} parameter
(in this class it is called {{encodeResult}}).

IMHO the issue is that {{DefaultUrlHelper}} has two use cases:
* Invoked with {{buildUrl()}}. In that case the parameter  {{encodeResult}} is present and
taken into account for the whole url. But parameters might have been already encoded.
* Invoked with {{buildParametersString()}}. In that case no encoding parameter is present
and it gets always encoded.

I'm going to add another version of {{buildParametersString()}} which has an encoding parameter.
The default will still be to encode.

> Space character and includeParams
> ---------------------------------
>                 Key: WW-4628
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.3.28
>            Reporter: Pierre-Yves Soblet
>             Fix For: 2.3.31
>         Attachments:
> With this JSP snippet using Struts 2 taglib:
> {code}
> myParameter=[<s:property value="%{#parameters['myParameter']}"/>]
> <br/>
> <s:url action="url" includeParams="get"/>
> <br/>
> <s:url action="url">
>     <s:param name="myParameter" value="%{#parameters['myParameter']}"/>
> </s:url>
> {code}
> When the action is called with a parameter containing a space (which is escaped in the
URL) :
> {code}
> localhost:8080/url?myParameter=with+space
> {code}
> The output is as follows :
> {code}
> myParameter=[with space]
> /url.action?myParameter=with%2Bspace
> /url.action?myParameter=with+space    
> {code}
> The *includeParams* attribute of the “url” tag seems to transform the "space" character
into the "plus" character (both in their url-encoded forms).

This message was sent by Atlassian JIRA

View raw message