You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2016/02/02 11:13:39 UTC

[jira] [Comment Edited] (CXF-6765) UrlUtils#urlDecode incorrectly decodes encoded path with encoded plus = %2B symbol

    [ https://issues.apache.org/jira/browse/CXF-6765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15128012#comment-15128012 ] 

Sergey Beryozkin edited comment on CXF-6765 at 2/2/16 10:13 AM:
----------------------------------------------------------------

The reason '+' is replaced by %2B first in case of a path component is that I recall one of JAX-RS spec authors confirming that in order to pass '+' in a path one does not have to encode it into %2B, i.e, one can actually pass '+' as is, I believe it is not listed as a special delimiter for a path component.  So if we have such a producer who means '+' is '+' then we can not replace with a space. 

'+' can be used as a space representation in the components whose values can be form encoded, which is a query; or a form body payload...

IMHO you should have either '%20+%20' or '%20%2B%20' 


was (Author: sergey_beryozkin):
The reason '+' is replaced by '%2B' first in case of a path component is that I recall one of JAX-RS spec authors confirming that in order to pass '+' in a path one does not have to encode it into '%2B', i.e, one can actually pass '+' as is, I believe it is not listed as a special delimiter for a path component.  So if we have such a producer who means '+' is '+' then we can not replace with a space. 

'+' can be used as a space representation in the components whose values can be form encoded, which is a query; or a form body payload...

IMHO you should have either '%20+%20' or '%20%2B%20' 

> UrlUtils#urlDecode incorrectly decodes encoded path with encoded plus = %2B symbol
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-6765
>                 URL: https://issues.apache.org/jira/browse/CXF-6765
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.1.4
>         Environment: WIndows 7, Java 8
>            Reporter: Karsten Ohme
>
> I'm decoding some matrix parameters. When using a path with an encoded + (= %2B encoded), e.g. filterValue=Foobar+%2B+Bar which should be "Foobar + Bar", but it is "Foobar  Bar", because the %2B is decoded as plus first and later decoded as a space.
> The error is produced in org.apache.cxf.common.util.UrlUtils#urlDecode(java.lang.String, java.lang.String, boolean).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)