aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-05-28 16:28:46 -0400
committerGeorge Claghorn <george@basecamp.com>2018-05-28 16:28:46 -0400
commit1bdaccc0b8cf8aac0dc833d6db14b9a902593ff5 (patch)
tree47c7fe84ded16a785feb86f42faa225175d4a8c4 /activestorage/app
parent34cc301f03aea2e579d6687a9ea9782afc1089a0 (diff)
downloadrails-1bdaccc0b8cf8aac0dc833d6db14b9a902593ff5.tar.gz
rails-1bdaccc0b8cf8aac0dc833d6db14b9a902593ff5.tar.bz2
rails-1bdaccc0b8cf8aac0dc833d6db14b9a902593ff5.zip
Verify integrity after chunked download
Diffstat (limited to 'activestorage/app')
-rw-r--r--activestorage/app/models/active_storage/blob.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb
index 134d3bb2d9..d36c951292 100644
--- a/activestorage/app/models/active_storage/blob.rb
+++ b/activestorage/app/models/active_storage/blob.rb
@@ -167,6 +167,8 @@ class ActiveStorage::Blob < ActiveRecord::Base
end
# Downloads the blob to a tempfile on disk. Yields the tempfile.
+ #
+ # Raises ActiveStorage::IntegrityError if the downloaded data does not match the blob's checksum.
def open(tempdir: nil, &block)
ActiveStorage::Downloader.new(self, tempdir: tempdir).download_blob_to_tempfile(&block)
end