Add exist? support to CellarService

This commit is contained in:
Frederic Merizen 2018-02-16 12:13:45 +01:00
parent 7df20a35cd
commit 009c4f9149

View file

@ -62,6 +62,19 @@ module ActiveStorage
end
end
def exist?(key)
instrument :exist, key: key do |payload|
http_start do |http|
request = Net::HTTP::Head.new(URI::join(@endpoint, "/#{key}"))
sign(request, key)
response = http.request(request)
answer = response.is_a?(Net::HTTPSuccess)
payload[:exist] = answer
answer
end
end
end
def url(key, expires_in:, filename:, disposition:, content_type:)
instrument :url, key: key do |payload|
generated_url = presigned_url(