download_strategy: move HOMEBREW_ARTIFACT_DOMAIN hack

This commit is contained in:
Bo Anderson 2023-06-27 14:33:23 +01:00
parent 77a4e2e82a
commit c969be340e
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

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) }