1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert back to the original implementaion with varaibles

Revert `exist? and url` to the original implementation.
Since the new one doesn't provide any benefits and makes implementation
harder to follow.
This commit is contained in:
dixpac 2017-07-14 20:46:02 +02:00
parent 6dcdc5c9ab
commit c49c56b469

View file

@ -36,14 +36,20 @@ class ActiveStorage::Service::GCSService < ActiveStorage::Service
def exist?(key)
instrument :exist, key do |payload|
payload[:exist] = file_for(key).present?
answer = file_for(key).present?
payload[:exist] = answer
answer
end
end
def url(key, expires_in:, disposition:, filename:)
instrument :url, key do |payload|
query = { "response-content-disposition" => "#{disposition}; filename=\"#{filename}\"" }
payload[:url] = file_for(key).signed_url(expires: expires_in, query: query)
generated_url = file_for(key).signed_url(expires: expires_in, query: query)
payload[:url] = generated_url
generated_url
end
end