From 0878c6deab82fa8864acbfb280c487b9f6fb7905 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 4 Nov 2012 11:19:28 +0100 Subject: [PATCH] Fix nodeload fallback URLs --- src/Composer/Downloader/ArchiveDownloader.php | 4 ++-- tests/Composer/Test/Downloader/ArchiveDownloaderTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index 9e1709699..e86fec849 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -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'); } diff --git a/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php b/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php index eb8709706..1d9de1508 100644 --- a/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php @@ -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); } } }