diff options
author | George Claghorn <george@basecamp.com> | 2017-07-06 15:31:31 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2017-07-06 15:31:31 -0400 |
commit | a2e864fa13c7d3d56a95a2f46d525597f989f938 (patch) | |
tree | aee9df0c4c8786afdf1865b55a84fe2d0d7b56c3 /lib | |
parent | 2afe0a7d90403cca862644edeb8a2e393ccbddc6 (diff) | |
download | rails-a2e864fa13c7d3d56a95a2f46d525597f989f938.tar.gz rails-a2e864fa13c7d3d56a95a2f46d525597f989f938.tar.bz2 rails-a2e864fa13c7d3d56a95a2f46d525597f989f938.zip |
Fix test
* S3 fails fast if the Content-MD5 header on an upload request is an
invalid checksum. Send a valid but incorrect checksum.
* Rescue the service-specific exception and raise the generic one.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_storage/service/s3_service.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/active_storage/service/s3_service.rb b/lib/active_storage/service/s3_service.rb index 413789e2b5..963a41af17 100644 --- a/lib/active_storage/service/s3_service.rb +++ b/lib/active_storage/service/s3_service.rb @@ -11,6 +11,8 @@ class ActiveStorage::Service::S3Service < ActiveStorage::Service def upload(key, io, checksum: nil) object_for(key).put(body: io, content_md5: checksum) + rescue Aws::S3::Errors::BadDigest + raise ActiveStorage::IntegrityError end def download(key) |