mirror of
https://github.com/mrclay/minify.git
synced 2025-02-24 08:52:50 +01:00
Issue 24. Make sure all accesses of DOCUMENT_ROOT are first passed through realpath() to resolve symlinks.
This commit is contained in:
parent
6dffb5e10e
commit
340c8a91fe
@ -282,7 +282,7 @@ class Minify_CSS {
|
||||
$path = self::$_tempCurrentDir
|
||||
. DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR);
|
||||
// strip doc root
|
||||
$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT']));
|
||||
$path = substr($path, strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
|
||||
// fix to absolute URL
|
||||
$url = strtr($path, DIRECTORY_SEPARATOR, '/');
|
||||
// remove /./ and /../ where possible
|
||||
@ -294,11 +294,9 @@ class Minify_CSS {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($isImport) {
|
||||
return "@import {$quote}{$url}{$quote}";
|
||||
} else {
|
||||
return "url({$quote}{$url}{$quote})";
|
||||
}
|
||||
return $isImport
|
||||
? "@import {$quote}{$url}{$quote}"
|
||||
: "url({$quote}{$url}{$quote})";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ class Minify_ImportProcessor {
|
||||
$path = $this->_currentDir
|
||||
. DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR);
|
||||
// strip doc root
|
||||
$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT']));
|
||||
$path = substr($path, strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
|
||||
// fix to absolute URL
|
||||
$url = strtr($path, DIRECTORY_SEPARATOR, '/');
|
||||
// remove /./ and /../ where possible
|
||||
|
Loading…
x
Reference in New Issue
Block a user