Merge pull request #15601 from Bo98/artifact_domain-fix

download_strategy: move HOMEBREW_ARTIFACT_DOMAIN hack
This commit is contained in:
Bo Anderson 2023-06-27 15:34:00 +01:00 committed by GitHub
commit eff45ef570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -383,7 +383,6 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
attr_reader :mirrors
def initialize(url, name, version, **meta)
super
@try_partial = true
@mirrors = meta.fetch(:mirrors, [])
@ -410,6 +409,10 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
begin
url = urls.shift
if (domain = Homebrew::EnvConfig.artifact_domain)
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
end
ohai "Downloading #{url}"
use_cached_location = cached_location.exist?
@ -477,10 +480,6 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
@resolved_info_cache ||= {}
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)
if (domain = Homebrew::EnvConfig.artifact_domain)
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
end
parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout)
parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) }