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

Sling should url decode the request url before trying to resolve to a resource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • Launchpad Base 2.3.0
    • None
    • None

    Description

      e.g.:
      JCR supports nodes with spaces (in its name), such as "Nice World".
      When accessing this node in Sling, the request url would look something like
      http://<sling host>/<path to node>/Nice%20World
      unfortunately we then try to resolve /<path to node>/Nice%20World in the JcrResourceRersolver which, of course, does NOT match/resolve!

      Hence somewhere before resolving the resource we should URLDecoder.decode the request URL ( request.getPathInfo() )

      Possible solution:
      SlingHttpServletRequest could provide
      public String getResourceLookupPath()
      {
      return URLDecoder.decode( request.getPathInfo(), "UTF-8" ) );
      }

      This method could be used in RequestData#initResource and possibly other places...
      public Resource initResource(ResourceResolver resourceResolver) {
      ...
      Resource resource = resourceResolver.resolve(request, request.getResourceLookupPath() );
      ...

      Or is it up to the JcrResourceResolver to decode the URL it gets?

      Attachments

        Activity

          People

            enorman Eric Norman
            clemensdev Clemens Wyss
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: