aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib
diff options
context:
space:
mode:
authorSimo Leone <leone.simo@gmail.com>2019-01-24 16:56:24 +0000
committerSimo Leone <leone.simo@gmail.com>2019-01-24 17:05:49 +0000
commitc5b71c9baea4959c096774c763e558df2979a9db (patch)
tree55fd34d33725056dc2c3dc3b9e5fb8ed7c5a936a /activestorage/lib
parent1fecebae31029cf2287f2bae88e8730f00569778 (diff)
downloadrails-c5b71c9baea4959c096774c763e558df2979a9db.tar.gz
rails-c5b71c9baea4959c096774c763e558df2979a9db.tar.bz2
rails-c5b71c9baea4959c096774c763e558df2979a9db.zip
include the content type when uploading to S3
Diffstat (limited to 'activestorage/lib')
-rw-r--r--activestorage/lib/active_storage/service/s3_service.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activestorage/lib/active_storage/service/s3_service.rb b/activestorage/lib/active_storage/service/s3_service.rb
index 382920ef61..bf94f3f49e 100644
--- a/activestorage/lib/active_storage/service/s3_service.rb
+++ b/activestorage/lib/active_storage/service/s3_service.rb
@@ -16,9 +16,9 @@ module ActiveStorage
@upload_options = upload
end
- def upload(key, io, checksum: nil, **)
+ def upload(key, io, checksum: nil, content_type: nil, **)
instrument :upload, key: key, checksum: checksum do
- object_for(key).put(upload_options.merge(body: io, content_md5: checksum))
+ object_for(key).put(upload_options.merge(body: io, content_md5: checksum, content_type: content_type))
rescue Aws::S3::Errors::BadDigest
raise ActiveStorage::IntegrityError
end