Эх сурвалжийг харах

Add support for file:///c:/-style paths, refs #3338

Jordi Boggiano 9 жил өмнө
parent
commit
ff46816e79

+ 2 - 2
src/Composer/Util/Filesystem.php

@@ -471,13 +471,13 @@ class Filesystem
      */
     public static function isLocalPath($path)
     {
-        return (bool) preg_match('{^(file://|/|[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
+        return (bool) preg_match('{^(file://|/|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
     }
 
     public static function getPlatformPath($path)
     {
         if (Platform::isWindows()) {
-            $path = preg_replace('{^(?:file:///([a-z])/)}i', 'file://$1:/', $path);
+            $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
         }
 
         return preg_replace('{^file://}i', '', $path);