Merge pull request #5337 from EricFromCanada/current-dir-redirect

CurlDownloadStrategy: handle Location header indicating the current directory
This commit is contained in:
Mike McQuaid 2018-11-23 14:19:36 +00:00 committed by GitHub
commit e3f69a48b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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