1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-15 02:24:13 +02:00

Issue 24. Make sure all accesses of DOCUMENT_ROOT are first passed through realpath() to resolve symlinks.

This commit is contained in:
Steve Clay
2008-10-08 13:20:12 +00:00
parent 6dffb5e10e
commit 340c8a91fe
2 changed files with 5 additions and 7 deletions

View File

@@ -282,7 +282,7 @@ class Minify_CSS {
$path = self::$_tempCurrentDir $path = self::$_tempCurrentDir
. DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR); . DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR);
// strip doc root // strip doc root
$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT'])); $path = substr($path, strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
// fix to absolute URL // fix to absolute URL
$url = strtr($path, DIRECTORY_SEPARATOR, '/'); $url = strtr($path, DIRECTORY_SEPARATOR, '/');
// remove /./ and /../ where possible // remove /./ and /../ where possible
@@ -294,11 +294,9 @@ class Minify_CSS {
} }
} }
} }
if ($isImport) { return $isImport
return "@import {$quote}{$url}{$quote}"; ? "@import {$quote}{$url}{$quote}"
} else { : "url({$quote}{$url}{$quote})";
return "url({$quote}{$url}{$quote})";
}
} }
/** /**

View File

@@ -141,7 +141,7 @@ class Minify_ImportProcessor {
$path = $this->_currentDir $path = $this->_currentDir
. DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR); . DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR);
// strip doc root // strip doc root
$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT'])); $path = substr($path, strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
// fix to absolute URL // fix to absolute URL
$url = strtr($path, DIRECTORY_SEPARATOR, '/'); $url = strtr($path, DIRECTORY_SEPARATOR, '/');
// remove /./ and /../ where possible // remove /./ and /../ where possible