diff options
author | George Claghorn <george@basecamp.com> | 2017-12-31 10:36:58 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2017-12-31 10:36:58 -0500 |
commit | 316d87e412e1c6bc9c7a590b866befbb6bab167f (patch) | |
tree | 81bfdb8d0a2437d0ea94894a31ec743f64189522 /activestorage/lib | |
parent | 5428c8e3a2d0f80240ac2e3e4b214b775ee2f346 (diff) | |
download | rails-316d87e412e1c6bc9c7a590b866befbb6bab167f.tar.gz rails-316d87e412e1c6bc9c7a590b866befbb6bab167f.tar.bz2 rails-316d87e412e1c6bc9c7a590b866befbb6bab167f.zip |
Append extension to tempfile name
Fixes analyzing an SVG image without an XML declaration. ImageMagick occasionally looks to the extension when it can't discern the type of an image file from its contents.
References #31356.
Diffstat (limited to 'activestorage/lib')
-rw-r--r-- | activestorage/lib/active_storage/downloading.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activestorage/lib/active_storage/downloading.rb b/activestorage/lib/active_storage/downloading.rb index 3dac6b116a..a57fda49b4 100644 --- a/activestorage/lib/active_storage/downloading.rb +++ b/activestorage/lib/active_storage/downloading.rb @@ -5,7 +5,7 @@ module ActiveStorage private # Opens a new tempfile in #tempdir and copies blob data into it. Yields the tempfile. def download_blob_to_tempfile # :doc: - Tempfile.open("ActiveStorage", tempdir) do |file| + Tempfile.open([ "ActiveStorage", blob.filename.extension_with_delimiter ], tempdir) do |file| download_blob_to file yield file end |