From 5051e7a0a27ee56d5a229132c4f283c831014cf6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 19 Oct 2012 10:23:50 +0200 Subject: [PATCH] Only try to authorize when fetching the repo info, not subsequent calls, refs #423 --- src/Composer/Repository/Vcs/GitHubDriver.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index bbe75f70f..d6e68d2f3 100755 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -238,7 +238,7 @@ class GitHubDriver extends VcsDriver /** * {@inheritDoc} */ - protected function getContents($url, $tryClone = false) + protected function getContents($url, $fetchingRepoData = false) { try { return parent::getContents($url); @@ -246,7 +246,12 @@ class GitHubDriver extends VcsDriver switch ($e->getCode()) { case 401: case 404: - if (!$this->io->isInteractive() && $tryClone) { + // try to authorize only if we are fetching the main /repos/foo/bar data, otherwise it must be a real 404 + if (!$fetchingRepoData) { + throw $e; + } + + if (!$this->io->isInteractive()) { return $this->attemptCloneFallback($e); } @@ -256,7 +261,7 @@ class GitHubDriver extends VcsDriver return parent::getContents($url); case 403: - if (!$this->io->isInteractive() && $tryClone) { + if (!$this->io->isInteractive() && $fetchingRepoData) { return $this->attemptCloneFallback($e); }