From 1bdaccc0b8cf8aac0dc833d6db14b9a902593ff5 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 28 May 2018 16:28:46 -0400 Subject: Verify integrity after chunked download --- activestorage/app/models/active_storage/blob.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activestorage/app/models') 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 -- cgit v1.2.3