Browse Source

Merge branch '1.6'

Jordi Boggiano 7 years ago
parent
commit
f31e2552be

+ 2 - 2
src/Composer/Downloader/DownloadManager.php

@@ -160,8 +160,8 @@ class DownloadManager
 
         if ($installationSource !== $downloader->getInstallationSource()) {
             throw new \LogicException(sprintf(
-                'Downloader "%s" is a %s type downloader and can not be used to download %s',
-                get_class($downloader), $downloader->getInstallationSource(), $installationSource
+                'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
+                get_class($downloader), $downloader->getInstallationSource(), $installationSource, $package
             ));
         }
 

+ 3 - 1
src/Composer/Repository/Vcs/GitHubDriver.php

@@ -361,7 +361,9 @@ class GitHubDriver extends VcsDriver
                         }
                     }
                     $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
-                    if (!$headers || count($scopesFailed)) {
+                    // non-authenticated requests get no scopesNeeded, so ask for credentials
+                    // authenticated requests which failed some scopes should ask for new credentials too
+                    if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
                         $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
                     }