[
https://issues.apache.org/jira/browse/SLING-9514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17134134#comment-17134134
]
Carsten Ziegeler commented on SLING-9514:
-----------------------------------------
While the javadoc states that everything should be encoded, the implementation
is actually treating the input as a url path - not a resource path - and
therefore applys special behaviour to handle a query string and fragment in
that url path.
So we should update the API javadoc to reflect the implemented behaviour
Changing the behaviour is an incompatible change that probably will break a lot
of applications out there - it has been like this for ten years.
> ResourceResolver.map should encode # and ?
> ------------------------------------------
>
> Key: SLING-9514
> URL: https://issues.apache.org/jira/browse/SLING-9514
> Project: Sling
> Issue Type: Bug
> Affects Versions: Resource Resolver 1.6.16
> Reporter: Hans-Peter Stoerr
> Priority: Minor
>
> According to SLING-8084 [ResourceResolver.map(request,
> url)|[https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html#map-javax.servlet.http.HttpServletRequest-java.lang.String-]]
> does a percent encoding, so that the result is a valid URL. Unfortunately it
> doesn't do that for the characters ? and #, which have special meanings in
> HTTP. I suggest also encoding these - otherwise the returned URL will not
> retrieve the resource when its name contains one of these characters.
> For good measure, I wonder whether it would be sensible to percent-encode
> other characters that have a special meaning in URLs as well, such as "=",
> ";", ":", "&", though that is not mandatory.
> I also suggest mentioning the encoding in [the description of the
> mapping|[https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html]].
> Thanks so much!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)