mirror of
https://github.com/mrclay/minify.git
synced 2025-08-21 05:11:46 +02:00
Changed allowDirs comparsion logic #497
This commit is contained in:
@@ -153,12 +153,17 @@ class Minify_Source_Factory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->options['checkAllowDirs']) {
|
if ($this->options['checkAllowDirs']) {
|
||||||
|
$inAllowedDir = false;
|
||||||
foreach ((array)$this->options['allowDirs'] as $allowDir) {
|
foreach ((array)$this->options['allowDirs'] as $allowDir) {
|
||||||
if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) !== 0) {
|
if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) === 0) {
|
||||||
throw new Minify_Source_FactoryException("File '{$spec['filepath']}' is outside \$allowDirs."
|
$inAllowedDir = true;
|
||||||
. " If the path is resolved via an alias/symlink, look into the \$min_symlinks option.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$inAllowedDir) {
|
||||||
|
throw new Minify_Source_FactoryException("File '{$spec['filepath']}' is outside \$allowDirs."
|
||||||
|
. " If the path is resolved via an alias/symlink, look into the \$min_symlinks option.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$basename = basename($spec['filepath']);
|
$basename = basename($spec['filepath']);
|
||||||
|
Reference in New Issue
Block a user