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

In ContentTypeFilter do not decode twice the uri

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2
    • Fix Version/s: 5.2.6, 5.3.2
    • Component/s: core
    • Labels:
      None

      Description

      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)
        	...
        

        Checklists

        Acceptance criteria

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Checklists

                    Bug DoR
                    DoD