ericwang14 / webutilities

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

Found problems in replaceALL in JSCSSMergeServlet.doGet() #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi

I don't know if this bug has been raised.

When the servlet replaces the relative path to absolute path for the URL's in 
the CSS.It uses the String.replaceALL the Utils.buildProperPath() does not 
handle the re-escaping of the backslash properly.

http://stackoverflow.com/questions/1701839/backslash-problem-with-string-replace
all

Original issue reported on code.google.com by santhosh...@gmail.com on 29 Jun 2011 at 12:41

GoogleCodeExporter commented 9 years ago
Thanks Santhosh for reporting this and also the reference.

Are you actually facing this problem in any of your CSS files having such 
referenced URLs? Are they getting printed to the browser with incorrect paths 
in them?

Our current tests either did not come across this problem or did not cover such 
scenarios but we will look into the problem.

Original comment by rr.patil...@gmail.com on 29 Jun 2011 at 5:30

GoogleCodeExporter commented 9 years ago
Firstly sorry for the delayed reply  
Secondly yes... I am as facing the problem with all the CSS files which have 
URL within them and yes they are getting printed with the incorrect URL.I tried 
putting the required amount of backslashes as state in the article in the 
Utils.buildProperPath() and it worked fine.

Original comment by santhosh...@gmail.com on 13 Jul 2011 at 11:37

GoogleCodeExporter commented 9 years ago
Thanks for the reply and suggestion of the fix. We will fix that soon.

Original comment by rr.patil...@gmail.com on 28 Jul 2011 at 4:01

GoogleCodeExporter commented 9 years ago
If you pointing to the below line
------------------------------------
...
return path.replaceAll("(/|\\./)+", "$1");
...
------------------------------------
then I hope the problem you mentioned doen't really apply to this line. We are 
not replacing or dealing with any "\" here. This line is to replace multiple 
consecutive occurrences of "./" or "/" by single one. 

Eg. 1. if path is  "///////abc/p//q" then it will be replaced as "/abc/p/q". 
Eg. 2. if path is  "././././a/b/c" then it will be replaced as "./a/b/c. 

However there was another problem in buildProperPath method on windows machines 
due File.separator and it has been fixed now. v0.0.5 will be released with the 
fix. Feel free to reopen if you think there is still something wrong and needs 
fix.

Original comment by rr.patil...@gmail.com on 15 Oct 2011 at 6:25

GoogleCodeExporter commented 9 years ago

Original comment by rr.patil...@gmail.com on 15 Oct 2011 at 6:34