1
0
Fork 0

Fix nodeload fallback URLs

pull/1288/head
Jordi Boggiano 2012-11-04 11:19:28 +01:00
parent 06a588c197
commit 0878c6deab
2 changed files with 3 additions and 3 deletions

View File

@ -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');
}

View File

@ -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);
}
}
}