From 6ed65c9e91bc86e2cbfb7dbc76b1e66e80de6201 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 5 Dec 2012 21:39:28 +0100 Subject: [PATCH] Reuse hostname var --- src/Composer/Downloader/FileDownloader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 384e7c735..752659040 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -87,14 +87,14 @@ class FileDownloader implements DownloaderInterface $processedUrl = $this->processUrl($package, $url); $hostname = parse_url($processedUrl, PHP_URL_HOST); - if (strpos($hostname, 'github.com') === (strlen($hostname) - 10)) { + if (strpos($hostname, '.github.com') === (strlen($hostname) - 11)) { $hostname = 'github.com'; } try { try { if (!$this->cache || !$this->cache->copyTo($this->getCacheKey($package), $fileName)) { - $this->rfs->copy(parse_url($processedUrl, PHP_URL_HOST), $processedUrl, $fileName); + $this->rfs->copy($hostname, $processedUrl, $fileName); if ($this->cache) { $this->cache->copyFrom($this->getCacheKey($package), $fileName); }