Fixing local file VCS URLs with encoded characters
realpath() returns FALSE for paths with URL encoding like %20, and decoded path needs file:/// reapplied.pull/5846/head
parent
98ba6d8bf4
commit
98d2fcb4d8
|
@ -67,15 +67,25 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
while ($url = array_shift($urls)) {
|
while ($url = array_shift($urls)) {
|
||||||
try {
|
try {
|
||||||
if (Filesystem::isLocalPath($url)) {
|
if (Filesystem::isLocalPath($url)) {
|
||||||
# realpath() below will not understand
|
// realpath() below will not understand
|
||||||
# url that starts with "file://"
|
// url that starts with "file://"
|
||||||
$needle = 'file://';
|
$needle = 'file://';
|
||||||
|
$is_file_protocol = false;
|
||||||
if (0 === strpos($url, $needle)) {
|
if (0 === strpos($url, $needle)) {
|
||||||
$url = substr($url, strlen($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);
|
$url = realpath($url);
|
||||||
|
|
||||||
|
if ($is_file_protocol) {
|
||||||
|
$url = $needle . $url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->doDownload($package, $path, $url);
|
$this->doDownload($package, $path, $url);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue