[
https://issues.apache.org/jira/browse/WW-4628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15293232#comment-15293232
]
Pierre-Yves Soblet commented on WW-4628:
----------------------------------------
I have tested the attached sample with previous Struts 2 releases from Maven
Central and it appears that the most recent relase (before 2.3.28.1) that is
NOT affected by this issue is 2.3.24.3.
There is a behavioral difference between URLDecoderUtil from Struts 2 and
URLDecoder from java.net.
{code}
@Test
public void shouldDecodeSpace() throws UnsupportedEncodingException {
String queryStringWithSpace = "a+b";
Assert.assertEquals(
java.net.URLDecoder.decode(queryStringWithSpace,
StandardCharsets.UTF_8.displayName()),
org.apache.struts2.util.URLDecoderUtil.decode(queryStringWithSpace,
StandardCharsets.UTF_8.displayName()));
}
{code}
yields :
{code}
org.junit.ComparisonFailure: expected:<a[ ]b> but was:<a[+]b>
{code}
> Space character and includeParams
> ---------------------------------
>
> Key: WW-4628
> URL: https://issues.apache.org/jira/browse/WW-4628
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.3.28
> Reporter: Pierre-Yves Soblet
> Fix For: 2.3.29
>
> Attachments: Struts2UrlTest.zip
>
>
> 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
(v6.3.4#6332)