Merge pull request #10863 from MikeMcQuaid/github_packages_bottle_domain

github_packages: fix HOMEBREW_BOTTLE_DOMAIN usage.
This commit is contained in:
Mike McQuaid 2021-03-16 15:48:54 +00:00 committed by GitHub
commit 59ada80ca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -13,7 +13,8 @@ class GitHubPackages
include Context include Context
include Utils::Curl include Utils::Curl
URL_REGEX = %r{https://ghcr.io/v2/([\w-]+)/([\w-]+)}.freeze URL_PREFIX = "https://ghcr.io/v2/"
URL_REGEX = %r{#{Regexp.escape(URL_PREFIX)}([\w-]+)/([\w-]+)}.freeze
sig { returns(String) } sig { returns(String) }
def inspect def inspect

View File

@ -379,7 +379,11 @@ class BottleSpecification
def root_url(var = nil, specs = {}) def root_url(var = nil, specs = {})
if var.nil? if var.nil?
@root_url ||= "#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}" @root_url ||= if Homebrew::EnvConfig.bottle_domain.start_with?(GitHubPackages::URL_PREFIX)
"#{GitHubPackages::URL_PREFIX}#{tap.full_name}"
else
"#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}"
end
else else
@root_url = var @root_url = var
@root_url_specs.merge!(specs) @root_url_specs.merge!(specs)