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

IllegalStateException when validateContentType is enabled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Neutral
    • None
    • 5.4.6
    • None
    • None

    Description

      To reproduce:

      1. Set /server/filters/contentType@validateContentType=true
      2. Request an image with a wrong extension (https://demo.magnolia-cms.com/.imaging/mte/travel-demo-theme/1366/dam/tours/flickr-swiss-trails-ed-coyle-3797048134_1f4a930f48_o.jpg/jcr:content/flickr-swiss-trails-ed-coyle-3797048134_1f4a930f48_o.jpg.jpg2)
      3. java.lang.IllegalStateException: Failure when attempting to set response header Content-Encoding: gzip
        	info.magnolia.cms.util.RequestHeaderUtil.addAndVerifyHeader(RequestHeaderUtil.java:69)
        	info.magnolia.module.cache.filter.GZipFilter.doFilter(GZipFilter.java:87)
        

      The culprit is possible in info.magnolia.cms.filters.ContentTypeCheckingResponseWrapper#setContentType which calls sendError but the filter chain is not finished.

      Possible solutions would be:

      • to set only the error state but call the sendError later in content type filter? OR
      • fix GZipFilter to not set the header when the response is committed

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              rkovarik Roman Kovařík
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD