Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download_strategy: fix mirrors not working #16079

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@
@resolved_info_cache ||= {}
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)

parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout)
begin
parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout)
rescue ErrorDuringExecution
return [url, parse_basename(url), nil, nil, false]

Check warning on line 494 in Library/Homebrew/download_strategy.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/download_strategy.rb#L494

Added line #L494 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required by your change but just a drive-by thought that this is a horrendous return signature that's dying to be a e.g. Hash or Struct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. Takes me a moment to understand everytime I look at it.

It's also difficult to change without breaking custom download strategies, so probably worth doing with a larger refactor with better public API.

end

parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) }

final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url)
Expand Down