galan / packtag

A JSP Taglib for delivering minified, combined and gzip-compressed resources (JavaScript and CSS).
Apache License 2.0
24 stars 13 forks source link

URIUtils removes one letter folders from path during resources rewrite process #7

Closed jakubkrolikowski closed 9 years ago

jakubkrolikowski commented 9 years ago

There is a simple bug in URIUtils, method cleanCurrentdirs(final String path), the first line:

String result = path.replaceAll("/./", "/");

should be, I guess:

String result = path.replaceAll("/\./", "/");

Dot . for regex means any character, so this replacement removes all one letter folder names from path. For example: /nh/img/t/pic.png give: /nh/img/pic.png

It happens when using resources.rewrite=true

galan commented 9 years ago

Hi jakubkrolikowski, thanks for reporting an issue. I'm currently unable to help you with this issue since I have no time at the moment. So if it is urgent you might fork this project, and I will try to merge it later.

jakubkrolikowski commented 9 years ago

I already solve this bug and patched sources. To fix this issue just replace first line of cleanCurrentdirs(final String path) in net.sf.packtag.util.URIUtils with: String result = path.replaceAll("/./", "/");