소스 검색

Try fixing 404s gitlab handling when unauthenticated, refs #6669

Jordi Boggiano 7 년 전
부모
커밋
f71baa5e0c
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      src/Composer/Util/RemoteFilesystem.php

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

@@ -354,6 +354,17 @@ class RemoteFilesystem
             }
         }
 
+        // check for gitlab 404 when downloading archives
+        if ($statusCode === 404
+            && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
+            && false !== strpos($fileUrl, 'archive.zip')
+        ) {
+            $result = false;
+            if ($this->retryAuthFailure) {
+                $this->promptAuthAndRetry(401);
+            }
+        }
+
         // handle 3xx redirects for php<5.6, 304 Not Modified is excluded
         $hasFollowedRedirect = false;
         if ($userlandFollow && $statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {