Merge pull request #4824 from reitermarkus/content-disposition-regex

Change regex to match `filename` if header also contains `filename*`.
This commit is contained in:
Markus Reiter 2018-09-05 04:14:03 +02:00 committed by GitHub
commit 3a4914664e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,7 +339,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
end
end
filenames = lines.map { |line| line[/^Content\-Disposition:\s*attachment;\s*filename=(["']?)(.+)\1$/i, 2] }
filenames = lines.map { |line| line[/^Content\-Disposition:\s*attachment;\s*filename=(["']?)([^;]+)\1/i, 2] }
.compact
basename = filenames.last || parse_basename(redirect_url)