diff options
author | George Claghorn <george@basecamp.com> | 2018-02-26 11:35:13 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-02-26 12:00:24 -0500 |
commit | 8a79d04e4dd7f0fc3c03fca905f86c03bc91ab11 (patch) | |
tree | 2343cddbfd921ac523afd8a3ace7eb920f0cadf5 /activestorage/lib | |
parent | 690d2a49465cf18b93cf66b77967cb1236c881cb (diff) | |
download | rails-8a79d04e4dd7f0fc3c03fca905f86c03bc91ab11.tar.gz rails-8a79d04e4dd7f0fc3c03fca905f86c03bc91ab11.tar.bz2 rails-8a79d04e4dd7f0fc3c03fca905f86c03bc91ab11.zip |
Avoid specifying content types for direct uploads to Google Cloud Storage
Fix customizing the download Content-Type for a directly-uploaded blob via a signed URL. See e8286ee.
Diffstat (limited to 'activestorage/lib')
-rw-r--r-- | activestorage/lib/active_storage/service/gcs_service.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activestorage/lib/active_storage/service/gcs_service.rb b/activestorage/lib/active_storage/service/gcs_service.rb index 6f6f4105fe..d163605754 100644 --- a/activestorage/lib/active_storage/service/gcs_service.rb +++ b/activestorage/lib/active_storage/service/gcs_service.rb @@ -80,10 +80,9 @@ module ActiveStorage end end - def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:) + def url_for_direct_upload(key, expires_in:, checksum:, **) instrument :url, key: key do |payload| - generated_url = bucket.signed_url key, method: "PUT", expires: expires_in, - content_type: content_type, content_md5: checksum + generated_url = bucket.signed_url key, method: "PUT", expires: expires_in, content_md5: checksum payload[:url] = generated_url @@ -91,8 +90,8 @@ module ActiveStorage end end - def headers_for_direct_upload(key, content_type:, checksum:, **) - { "Content-Type" => content_type, "Content-MD5" => checksum } + def headers_for_direct_upload(key, checksum:, **) + { "Content-Type" => "", "Content-MD5" => checksum } end private |