aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/downloading.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-04-23 16:42:47 -0500
committerGeorge Claghorn <george@basecamp.com>2018-04-23 16:44:13 -0500
commite4c51864286e790ba1cdec1e05fe8fadfb42330b (patch)
tree2007b437c85b2981e268399a47c4c9f1fef043ea /activestorage/lib/active_storage/downloading.rb
parentef5902a2f195c2be5a4e9ad0f31003774a93aa1c (diff)
downloadrails-e4c51864286e790ba1cdec1e05fe8fadfb42330b.tar.gz
rails-e4c51864286e790ba1cdec1e05fe8fadfb42330b.tar.bz2
rails-e4c51864286e790ba1cdec1e05fe8fadfb42330b.zip
Flush tempfile after populating it
Ensure that other processes like ImageMagick and FFmpeg see the complete contents of the file.
Diffstat (limited to 'activestorage/lib/active_storage/downloading.rb')
-rw-r--r--activestorage/lib/active_storage/downloading.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activestorage/lib/active_storage/downloading.rb b/activestorage/lib/active_storage/downloading.rb
index f2a1fffdcb..7c3d20ade0 100644
--- a/activestorage/lib/active_storage/downloading.rb
+++ b/activestorage/lib/active_storage/downloading.rb
@@ -27,6 +27,7 @@ module ActiveStorage
def download_blob_to(file) #:doc:
file.binmode
blob.download { |chunk| file.write(chunk) }
+ file.flush
file.rewind
end