xuetaohe / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

RewriteURI bug with differents path #209

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

docRoot    : /var/www/public/site/admin
currentDir : /var/www/public/site/includes/css

file-relative URI  : ../../images/bg_foot.jpg
path prepended     : /var/www/public/site/includes/css/../../images/bg_foot.jpg
docroot stripped   : des/css/../../images/bg_foot.jpg
traversals removed : des/../images/bg_foot.jpg

the file-relative URI and the path prepended are OK, but the error appears 
because of the admin directory.

I think the probleme comes from this line 
$path = substr($path, strlen($realDocRoot));
in the rewriteRelative function

the traversals removed line should be ../images/bg_foot.jpg
(/var/www/public/site/images/bg_foot.jpg)

Original issue reported on code.google.com by myesho...@gmail.com on 1 Dec 2010 at 9:05

GoogleCodeExporter commented 9 years ago
I think to get this working you'd need to place /min/ inside 
/var/www/public/site and include the code on the AlternateFileLayouts wiki page.

Original comment by mrclay....@gmail.com on 1 Dec 2010 at 4:54

GoogleCodeExporter commented 9 years ago
in fact I don't use minify fully, I'm just using the CSS compressor and 
UriRewriter class

Original comment by myesho...@gmail.com on 2 Dec 2010 at 8:16

GoogleCodeExporter commented 9 years ago
The rewriter can only produce root-relative URIs, so assuming the URI 
"/images/bg_foot.jpg" would work for you, then you really need to pass in 
"/var/www/public/site" as your docRoot.

Original comment by mrclay....@gmail.com on 2 Dec 2010 at 1:17