From e4c51864286e790ba1cdec1e05fe8fadfb42330b Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 23 Apr 2018 16:42:47 -0500 Subject: Flush tempfile after populating it Ensure that other processes like ImageMagick and FFmpeg see the complete contents of the file. --- activestorage/lib/active_storage/downloading.rb | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3