instance method
url_for_direct_upload
Ruby on Rails 8.0.5.2
Since v5.2.8.1Signature
url_for_direct_upload(key, expires_in:, checksum:, content_length:, custom_metadata: {}, **)
No documentation comment.
Parameters
-
keyreq -
expires_inkeyreq -
checksumkeyreq -
content_lengthkeyreq -
custom_metadatakey = {} -
kwargskeyrest
Source
# File activestorage/lib/active_storage/service/gcs_service.rb, line 92
def url_for_direct_upload(key, expires_in:, checksum:, content_length:, custom_metadata: {}, **)
instrument :url, key: key do |payload|
# V2 signatures bind the Content-Type (empty) and Content-MD5 headers. GCS leaves headers
# other than x-goog-* out of V2 signatures, so the client sends Cache-Control unsigned.
args = {
content_md5: checksum,
expires: expires_in,
headers: { "x-goog-content-length-range" => content_length_range(content_length), **custom_metadata_headers(custom_metadata) },
method: "PUT",
version: :v2,
}
if @config[:iam]
args[:issuer] = issuer
args[:signer] = signer
end
generated_url = bucket.signed_url(key, **args)
payload[:url] = generated_url
generated_url
end
end
Defined in activestorage/lib/active_storage/service/gcs_service.rb line 92
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Service::GCSService