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

Karl Pauls commented on SLING-8341:
-----------------------------------

I guess the main issue is the question of how we want to handle paths with more 
than one consecutive "/" in them. Clearly, the current logic doesn't take them 
into account properly as the pathinfo should end-up being the path to the 
resource - hence, at a minimum, we should fix that part where it doesn't 
calculate the pathinfo correctly. However, that would implicitly mean we just 
ignore extra slashes (if I read the code correctly).

 

[~cziegeler], what do you think the correct behaviour should be?

> unexpected results from resourceresolver.map when input path has adjacent '/'
> -----------------------------------------------------------------------------
>
>                 Key: SLING-8341
>                 URL: https://issues.apache.org/jira/browse/SLING-8341
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.6.8
>            Reporter: Ashok Kumar
>            Priority: Major
>         Attachments: Variables-resolveInternal.png
>
>
> Scenario : - ResourceResolver.map(‘/content/we-retail/us*//*en.html’) results 
> in ‘/content/we-retail/us/enn.html’
> Steps to Reproduce :
>  1. Go to console /system/console/jcrresolver
>  2. input link "/content/we-retail/us//en.html" to Configuration Test
>  3. click map
>  4. the result shows
>  Output 
>  Primary: /content/we-retail/us/enn.html. Other candidates: 
> /content/we-retail/us//en.html.
> Analysis:
> Attached is the variable states at Line 772 
> [https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/master/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L769-L770]
>  
> [https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/master/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L732-L763]
>  gives resolutionPath = "/content/we-retail/us/en" but original absPath input 
> param had an extra slash so pathinfo gets extra character in this case 'n'. 
> Refer attached variable state. If there are three adjacent slashes , pathinfo 
> would have two extra chars 'en'. 
>  
> Questions: - How to handle such input gracefully 
> what should be the output - throw an exception and exit OR return the 
> original path itself OR automatically remove adjacent slashes and replace 
> that with single '/'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to