Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5833

In ContentTypeFilter do not decode twice the uri

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 5.2.6, 5.3.2
    • 5.2
    • core
    • None

      in info.magnolia.cms.filters.ContentTypeFilter line 98

      String requestURI = URI.create(ServletUtil.getRequestUri(request)).normalize().getPath();
      aggregationState.setCurrentURI(URLDecoder.decode(requestURI, characterEncoding));
      

      the requestURI is decoded twice and this generate error in case of % in the URI:

      • ServletUtil.getRequestUri(request)).normalize() --> .../image%25name.. (%25 is the encoded value of %)
      • .getPath() decode the URI --> .../image%name...
      • performing a URLDecoder.decode(requestURI, characterEncoding) will try to decode the already decoded string -->
        java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "wi"
        	at java.net.URLDecoder.decode(URLDecoder.java:173)
        	at info.magnolia.cms.filters.ContentTypeFilter.doFilter(ContentTypeFilter.java:100)
        	...
        

        Acceptance criteria

              ehechinger Eric Hechinger
              ehechinger Eric Hechinger
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD