From 3eeb6214eb0c9b2a17593583e78edac504c1dcf7 Mon Sep 17 00:00:00 2001 From: Stefan Grootscholten Date: Wed, 28 Dec 2016 00:10:27 +0100 Subject: [PATCH] Fix RemoteFilesystem::isPublicBitBucketDownload The access token was added to requests to third party hosts the bitbucket api is redirecting to. --- src/Composer/Util/RemoteFilesystem.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index b6fd65a46..2d6f76b32 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -997,6 +997,13 @@ class RemoteFilesystem */ private function isPublicBitBucketDownload($urlToBitBucketFile) { + $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST); + if (strpos($domain, 'bitbucket.org') === false) { + // Bitbucket downloads are hosted on amazonaws. + // We do not need to authenticate there at all + return true; + } + $path = parse_url($urlToBitBucketFile, PHP_URL_PATH); // Path for a public download follows this pattern /{user}/{repo}/downloads/{whatever}