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.
This commit is contained in:
EricFromCanada
2018-11-22 19:24:30 -05:00
parent 7241156080
commit 5e2f87f7ac
+3
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