Fix Filesystem::isLocalPath including windows checks on linux
parent
f38df849c2
commit
3c37a67c0c
|
@ -638,9 +638,15 @@ class Filesystem
|
||||||
*/
|
*/
|
||||||
public static function isLocalPath(string $path)
|
public static function isLocalPath(string $path)
|
||||||
{
|
{
|
||||||
|
// on windows, \\foo indicates network paths so we exclude those from local paths, however it is unsafe
|
||||||
|
// on linux as file:////foo (which would be a network path \\foo on windows) will resolve to /foo which could be a local path
|
||||||
|
if (Platform::isWindows()) {
|
||||||
return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
|
return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Preg::isMatch('{^(file://|/|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue