From 58c29146f010112e021dca6beb95015595684498 Mon Sep 17 00:00:00 2001 From: Stephan Vock Date: Thu, 6 Jan 2022 13:58:58 +0000 Subject: [PATCH] GitLab: detect repository functionality disabled in Driver --- src/Composer/Repository/Vcs/GitLabDriver.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index e775dd269e1c..dd7cb65b2a86 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -504,6 +504,11 @@ protected function getContents($url, $fetchingRepoData = false) // force auth as the unauthenticated version of the API is broken if (!isset($json['default_branch'])) { + // GitLab allows you to disable the repository inside a project to use a project only for issues and wiki + if (isset($json['repository_access_level']) && $json['repository_access_level'] === 'disabled') { + throw new TransportException('The GitLab repository is disabled in the project', 400); + } + if (!empty($json['id'])) { $this->isPrivate = false; }