Add fallback for out-of-spec Last-Modified header.

This commit is contained in:
Markus Reiter 2019-08-20 03:17:59 +02:00
parent b9a30d154f
commit ff7c9ef1b9

View File

@ -390,7 +390,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
time =
lines.map { |line| line[/^Last\-Modified:\s*(.+)/i, 1] }
.compact
.map(&Time.public_method(:parse))
.map { |t| t.match?(/^\d+$/) ? Time.at(t.to_i) : Time.parse(t) }
.last
basename = filenames.last || parse_basename(redirect_url)