From 0d4ba40688785ad65da1af36b3ad8efd8e14505e Mon Sep 17 00:00:00 2001 From: Marcelo Perini Veloso Date: Wed, 5 Sep 2018 00:21:44 -0300 Subject: Fix zero-byte files upload --- activestorage/app/models/active_storage/blob/identifiable.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activestorage/app') diff --git a/activestorage/app/models/active_storage/blob/identifiable.rb b/activestorage/app/models/active_storage/blob/identifiable.rb index 049e45dc3e..2c17ddc25f 100644 --- a/activestorage/app/models/active_storage/blob/identifiable.rb +++ b/activestorage/app/models/active_storage/blob/identifiable.rb @@ -15,6 +15,10 @@ module ActiveStorage::Blob::Identifiable end def download_identifiable_chunk - service.download_chunk key, 0...4.kilobytes + if byte_size.positive? + service.download_chunk key, 0...4.kilobytes + else + "" + end end end -- cgit v1.2.3