diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 2918d2366..9f9fc6b7c 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -67,15 +67,25 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa while ($url = array_shift($urls)) { try { if (Filesystem::isLocalPath($url)) { - # realpath() below will not understand - # url that starts with "file://" + // realpath() below will not understand + // url that starts with "file://" $needle = 'file://'; + $is_file_protocol = false; if (0 === strpos($url, $needle)) { $url = substr($url, strlen($needle)); + $is_file_protocol = true; } - // realpath() will also not understand %20 etc - $url = rawurldecode($url); + + // realpath() below will not understand %20 spaces etc. + if (false !== strpos($url, '%')) { + $url = rawurldecode($url); + } + $url = realpath($url); + + if ($is_file_protocol) { + $url = $needle . $url; + } } $this->doDownload($package, $path, $url); break;