diff options
Diffstat (limited to 'lib/active_storage')
-rw-r--r-- | lib/active_storage/service/gcs_service.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/active_storage/service/gcs_service.rb b/lib/active_storage/service/gcs_service.rb index b0ad3e2fa4..7053a130c0 100644 --- a/lib/active_storage/service/gcs_service.rb +++ b/lib/active_storage/service/gcs_service.rb @@ -53,6 +53,17 @@ class ActiveStorage::Service::GCSService < ActiveStorage::Service end end + def url_for_direct_upload(key, expires_in:, content_type:, content_length:) + instrument :url, key do |payload| + generated_url = bucket.signed_url key, method: "PUT", expires: expires_in, + content_type: content_type + + payload[:url] = generated_url + + generated_url + end + end + private def file_for(key) bucket.file(key) |