changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

WildcardExpanderModelTransformer problem with /** url #440

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If the resource in a group uses deep wilcard and starts at the root, then the 
WildcardExpanderModelTransformer can not find referenced resources.

Example: The following group:
<group name="main_style">
 <css>/**.css</css>
 <js>/**.js</js>
</group>

would be empty.

More details: If the "ie.css" file is located in "resources/" directory, 
preprocessor executor looks for "//resources/ie.css" which does not exists. It 
should look for "/resources/ie.css" instead.

The problem is in the createExpanderHandler method of 
WildcardExpanderModelTransformer. It uses 
FilenameUtils.getFullPathNoEndSeparator to get the resource path without the 
last slash. This method is unwilling to return an empty string. E.g.:
* FilenameUtils.getFullPathNoEndSeparator("/resources/**.css") returns 
"/resources
* FilenameUtils.getFullPathNoEndSeparator("/**.css") returns "/"

Note: Following group works correcty:
<group name="main_style">
 <css>/resources/**.css</css>
 <js>/resources/**.js</js>
</group>

More details on this pull request on github: 
https://github.com/alexo/wro4j/pull/44

Original issue reported on code.google.com by alex.obj...@gmail.com on 17 May 2012 at 2:22

GoogleCodeExporter commented 9 years ago
A pull request was contributed by Mária Jurčovičová.

Original comment by alex.obj...@gmail.com on 17 May 2012 at 2:23