From ef540d0365754280cba8d9f4aed07d3c68398c6e Mon Sep 17 00:00:00 2001 From: Dustin Rodrigues Date: Wed, 22 Jul 2020 17:37:02 -0400 Subject: [PATCH] curl: ensure final_url is populated with the final URL requested --- Library/Homebrew/utils/curl.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index f767fdb0e3..e28265867e 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -201,7 +201,8 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent: while status_code == :unknown || status_code.to_s.start_with?("3") headers, _, output = output.partition("\r\n\r\n") status_code = headers[%r{HTTP/.* (\d+)}, 1] - final_url = headers[/^Location:\s*(.*)$/i, 1]&.chomp + location = headers[/^Location:\s*(.*)$/i, 1] + final_url = location.chomp if location end output_hash = Digest::SHA256.file(file.path) if hash_needed