Fix Filesystem::isLocalPath including windows checks on linux
parent
7a1e02d1a3
commit
406e3f9ede
|
@ -628,7 +628,13 @@ class Filesystem
|
|||
*/
|
||||
public static function isLocalPath($path)
|
||||
{
|
||||
return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue