Browse Source

Merge pull request #4419 from sroze/real-system-path

Uses `realpath` to fix relative path issues
Jordi Boggiano 9 năm trước cách đây
mục cha
commit
fbf61ae671
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      src/Composer/Downloader/PathDownloader.php

+ 5 - 4
src/Composer/Downloader/PathDownloader.php

@@ -39,18 +39,19 @@ class PathDownloader extends FileDownloader
         ));
 
         $url = $package->getDistUrl();
-        if (!file_exists($url) || !is_dir($url)) {
+        $realUrl = realpath($url);
+        if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
             throw new \RuntimeException(sprintf(
                 'Path "%s" is not found',
-                $path
+                $url
             ));
         }
 
         try {
-            $fileSystem->symlink($url, $path);
+            $fileSystem->symlink($realUrl, $path);
             $this->io->writeError(sprintf('    Symlinked from %s', $url));
         } catch (IOException $e) {
-            $fileSystem->mirror($url, $path);
+            $fileSystem->mirror($realUrl, $path);
             $this->io->writeError(sprintf('    Mirrored from %s', $url));
         }