mirror of
https://github.com/mrclay/minify.git
synced 2025-08-19 12:21:20 +02:00
Makes sure all file/dir paths are normalized to prepare for comparing.
Particularly the system docRoot and currentDir values passed to the URI rewriter and the allowDirs check.
This commit is contained in:
@@ -110,20 +110,6 @@ class Minify_Source_Factory {
|
||||
return $realpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* turn windows-style slashes into unix-style,
|
||||
* remove trailing slash
|
||||
* and lowercase drive letter
|
||||
*
|
||||
* @param string $path absolute path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNormalizedPath($path)
|
||||
{
|
||||
return lcfirst(rtrim(str_replace('\\', '/', $path), '/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $spec
|
||||
*
|
||||
@@ -159,8 +145,9 @@ class Minify_Source_Factory {
|
||||
if ($this->options['checkAllowDirs']) {
|
||||
$allowDirs = (array)$this->options['allowDirs'];
|
||||
$inAllowedDir = false;
|
||||
$filePath = $this->env->normalizePath($spec['filepath']);
|
||||
foreach ($allowDirs as $allowDir) {
|
||||
if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) === 0) {
|
||||
if (strpos($filePath, $this->env->normalizePath($allowDir)) === 0) {
|
||||
$inAllowedDir = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user