URL decoding
------------

                 Key: SLING-1846
                 URL: https://issues.apache.org/jira/browse/SLING-1846
             Project: Sling
          Issue Type: Bug
            Reporter: Pierre-Luc Rigaux


When we send an encoded url it is not decoded by Sling and it result by a 404 
answer.

Exemple

"/test/My%20story.doc" should be decoded to "/test/My%20story.doc"
        
"%E9%9F%B3%E4%B9%90.mp3" should be decoded to "音乐.mp3"

My workaround was to add this code to 
org.apache.sling.engine.impl.SlingHttpServletRequestImpl.SlingHttpServletRequestImpl(RequestData,
 HttpServletRequest) construtor

 // prepare the pathInfo property
        String pathInfo = servletRequest.getServletPath();
        if (servletRequest.getPathInfo() != null) {
            pathInfo = pathInfo.concat(servletRequest.getPathInfo());
            try {
                                pathInfo = URLDecoder.decode(pathInfo, "UTF-8");
                        } catch (UnsupportedEncodingException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                        }
        }
        this.pathInfo = pathInfo;

By checking a bit the method 
javax.servlet.http.HttpServletRequest.getServletPath() should return a decoded 
url, witch it is not the case. I find out that implementation was the felix 
one, but I didn't go further.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to