You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2021/03/19 14:25:00 UTC

[jira] [Resolved] (WICKET-6860) ConcatBundleResource double scope processing when CssUrlReplacer is used

     [ https://issues.apache.org/jira/browse/WICKET-6860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Tzvetanov Grigorov resolved WICKET-6860.
-----------------------------------------------
    Fix Version/s: 8.12.0
                   9.3.0
       Resolution: Fixed

> ConcatBundleResource double scope processing when CssUrlReplacer is used
> ------------------------------------------------------------------------
>
>                 Key: WICKET-6860
>                 URL: https://issues.apache.org/jira/browse/WICKET-6860
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.5.0
>            Reporter: William Headrick
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>             Fix For: 9.3.0, 8.12.0
>
>         Attachments: demo_6860.zip
>
>
> 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...|https://github.com/apache/wicket/commit/e2a11151e2bc55ae3a637efd88b1202582461780/#diff-b394ae1f7fce412b517619f435cf3f7035be89e283cd541c90975a70b7afd9caR194]
>   
> 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')
>   
>   
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)