Pārlūkot izejas kodu

Fix nodeload fallback URLs

Jordi Boggiano 12 gadi atpakaļ
vecāks
revīzija
0878c6deab

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

+ 1 - 1
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);
         }
     }
 }