Merge pull request #9496 from reitermarkus/fix-curl_http_content_headers_and_checksum

Fix `curl_http_content_headers_and_checksum`.
This commit is contained in:
Markus Reiter 2020-12-10 08:38:40 +01:00 committed by GitHub
commit db73cd2049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -249,7 +249,7 @@ module Utils
final_url = location.chomp if location final_url = location.chomp if location
end end
output_hash = Digest::SHA256.file(file.path) if hash_needed file_hash = Digest::SHA256.file(file.path) if hash_needed
final_url ||= url final_url ||= url
@ -260,8 +260,8 @@ module Utils
etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2], etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2],
content_length: headers[/Content-Length: (\d+)/, 1], content_length: headers[/Content-Length: (\d+)/, 1],
headers: headers, headers: headers,
file_hash: output_hash, file_hash: file_hash,
file: output, file: File.read(file.path),
} }
ensure ensure
file.unlink file.unlink