Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6860

ConcatBundleResource double scope processing when CssUrlReplacer is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 8.5.0
    • 9.3.0, 8.12.0
    • wicket-core
    • None

    Description

      There is "double scope processing" of a url in a PackageResource when the CssCompressor set on the Application ResourceSettings implements .IScopeAwareTextResourceProcessor.

      The CssUrlReplacer (for example) makes the urls relative during the PackageResource.compressResponse call.  The compressResponse ends up being called in ConcatBundleResource.readAllResources as part of `IOUtils.copy(curStream.getInputStream(), output)` and then ConcatBundleResource calls CssUrlReplacer.process again.  
       
      https://github.com/apache/wicket/commit/e2a11151e2bc55ae3a637efd88b1202582461780/ causes a "double scope processing" of a url in a PackageResource.  The second application of the CssCompressor happens here https://github.com/apache/wicket/commit/e2a11151e2bc55ae3a637efd88b1202582461780/#diff-b394ae1f7fce4...
       

      Set the CssCompressor on the Application.  Something like this in the Application `init` for example:
       
      this.getResourceSettings().setCssCompressor(new CssUrlReplacer())
       
      The CssUrlReplacer gets set on both the PackageResource and ConcatBundleResource as the Compressor.
       
       
      So, given this in the PackageResource css:
      background: url('../img/header_logo_r.png');
       
      this bad url gets inserted into the combined css file:
      background (generated in 8.5.0+): url('../com.foo.pages.SomePage/stylesheet/com.foo.pages.SomePage/img/header_logo_r-ver-1.4.0-ver-1.4.0.png')
       
      whereas this is the correct ScopeAware path (which is generated in <8.5.0):
      background: url('../com.foo.pages.SomePage/img/header_logo_r-ver-1.4.0.png')
       
       
       

      Attachments

        1. demo_6860.zip
          30 kB
          William Headrick

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              headw01 William Headrick
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: