浏览代码

Bail out of the normal 401 handling routine when the origin is GitHub

Chris Smith 11 年之前
父节点
当前提交
23d35204cd
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/Composer/Util/RemoteFilesystem.php

+ 5 - 0
src/Composer/Util/RemoteFilesystem.php

@@ -247,6 +247,11 @@ class RemoteFilesystem
                         throw new TransportException($message, 401);
                     }
 
+                    // GitHub requests bail out early to allow 2FA to be applied if requested.
+                    if ('github.com' === $this->originUrl) {
+                        throw new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.trim($message).')', 401);
+                    }
+
                     $this->promptAuthAndRetry();
                     break;
                 }