From 5e2f87f7ac860fc18105ef60a63c141b405ea0f8 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Thu, 22 Nov 2018 16:50:21 -0500 Subject: [PATCH] CurlDownloadStrategy: handle Location indicating the current dir. If a response contains a Location header starting with `./`, substitute just final component of the URL path with the given filename. --- Library/Homebrew/download_strategy.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index ad459318db..86d458f5ee 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -353,6 +353,9 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy elsif location.start_with?("/") uri = URI(current_url) "#{uri.scheme}://#{uri.host}#{location}" + elsif location.start_with?("./") + uri = URI(current_url) + "#{uri.scheme}://#{uri.host}#{Pathname(uri.path).dirname/location}" else location end