Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-8341

unexpected results from resourceresolver.map when input path has adjacent '/'

    XMLWordPrintableJSON

Details

    Description

      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 '/'

      Attachments

        1. Variables-resolveInternal.png
          124 kB
          Ashok Kumar

        Issue Links

          Activity

            People

              karlpauls Karl Pauls
              ashokpanghal Ashok Kumar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m