Fix nodeload fallback URLs
parent
06a588c197
commit
0878c6deab
|
@ -93,8 +93,8 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
|
||||
if (!extension_loaded('openssl') && (0 === strpos($url, 'https:') || 0 === strpos($url, 'http://github.com'))) {
|
||||
// bypass https for github if openssl is disabled
|
||||
if (preg_match('{^https?://(github.com/[^/]+/[^/]+/(zip|tar)ball/[^/]+)$}i', $url, $match)) {
|
||||
$url = 'http://nodeload.'.$match[1];
|
||||
if (preg_match('{^https?://github.com/([^/]+/[^/]+)/(zip|tar)ball/([^/]+)$}i', $url, $match)) {
|
||||
$url = 'http://nodeload.github.com/'.$match[1].'/legacy.'.$match[2].'/'.$match[3];
|
||||
} else {
|
||||
throw new \RuntimeException('You must enable the openssl extension to download files via https');
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class ArchiveDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
if (extension_loaded('openssl')) {
|
||||
$this->assertEquals($expected, $url);
|
||||
} else {
|
||||
$this->assertEquals('http://nodeload.github.com/composer/composer/zipball/master', $url);
|
||||
$this->assertEquals('http://nodeload.github.com/composer/composer/legacy.zip/master', $url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue