Explorar el Código

Merge pull request #5095 from schlessera/schlessera-4451-relative-path

Make sure to use an absolute path for symlinking in PathDownloader.
Jordi Boggiano hace 9 años
padre
commit
340d9789c8
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      src/Composer/Downloader/PathDownloader.php

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

@@ -79,7 +79,11 @@ class PathDownloader extends FileDownloader
                     $this->filesystem->junction($realUrl, $path);
                     $this->io->writeError(sprintf('    Junctioned from %s', $url));
                 } else {
-                    $shortestPath = $this->filesystem->findShortestPath($path, $realUrl);
+                    $absolutePath = $path;
+                    if ( ! $this->filesystem->isAbsolutePath($absolutePath)) {
+                        $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
+                    }
+                    $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
                     $fileSystem->symlink($shortestPath, $path);
                     $this->io->writeError(sprintf('    Symlinked from %s', $url));
                 }