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:
@@ -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})";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user