mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 07:56:07 +01:00
Fix ResourceLocator not working with multiple paths
This commit is contained in:
@@ -83,14 +83,14 @@ class ResourceLocator
|
||||
$scheme = 'file';
|
||||
}
|
||||
|
||||
if (!$file || $uri[0] == ':') {
|
||||
throw new \InvalidArgumentException('Invalid resource URI');
|
||||
}
|
||||
if (!isset($this->schemes[$scheme])) {
|
||||
throw new \InvalidArgumentException("Invalid resource {$scheme}://");
|
||||
}
|
||||
if (!$file && $scheme == 'file') {
|
||||
$file = getcwd();
|
||||
}
|
||||
|
||||
$paths = $array ? [] : false;
|
||||
$results = $array ? [] : false;
|
||||
foreach ($this->schemes[$scheme] as $prefix => $paths) {
|
||||
if ($prefix && strpos($file, $prefix) !== 0) {
|
||||
continue;
|
||||
@@ -104,11 +104,11 @@ class ResourceLocator
|
||||
if (!$array) {
|
||||
return $absolute ? $lookup : $filename;
|
||||
}
|
||||
$paths[] = $absolute ? $lookup : $filename;
|
||||
$results[] = $absolute ? $lookup : $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user