From 0454669656ce08668cad8e5aaad1536339ae737d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Sep 2023 09:31:34 +0100 Subject: [PATCH] utils/shared_audits: handle 404 metadata errors from GitLab API. Fixes #15995. --- Library/Homebrew/utils/shared_audits.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/shared_audits.rb b/Library/Homebrew/utils/shared_audits.rb index af3ff7913b..923245645a 100644 --- a/Library/Homebrew/utils/shared_audits.rb +++ b/Library/Homebrew/utils/shared_audits.rb @@ -59,7 +59,9 @@ module SharedAudits @gitlab_repo_data ||= {} @gitlab_repo_data["#{user}/#{repo}"] ||= begin out, _, status = Utils::Curl.curl_output("https://gitlab.com/api/v4/projects/#{user}%2F#{repo}") - JSON.parse(out) if status.success? + json = JSON.parse(out) if status.success? + json = nil if json&.dig("message")&.include?("404 Project Not Found") + json end end