diff options
-rw-r--r-- | activestorage/lib/active_storage/service/gcs_service.rb | 9 | ||||
-rw-r--r-- | activestorage/test/service/gcs_service_test.rb | 2 |
2 files changed, 5 insertions, 6 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 diff --git a/activestorage/test/service/gcs_service_test.rb b/activestorage/test/service/gcs_service_test.rb index 7efcd60fb7..fc2d9d0fa7 100644 --- a/activestorage/test/service/gcs_service_test.rb +++ b/activestorage/test/service/gcs_service_test.rb @@ -19,7 +19,7 @@ if SERVICE_CONFIGURATIONS[:gcs] uri = URI.parse url request = Net::HTTP::Put.new uri.request_uri request.body = data - request.add_field "Content-Type", "text/plain" + request.add_field "Content-Type", "" request.add_field "Content-MD5", checksum Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| http.request request |