From fcbe17137db2ae074cc2592f7498366e313f0d9f Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 12 Mar 2018 21:54:54 -0400 Subject: Fix Azure signed URL generation with newer client lib --- .../lib/active_storage/service/azure_storage_service.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'activestorage/lib/active_storage') diff --git a/activestorage/lib/active_storage/service/azure_storage_service.rb b/activestorage/lib/active_storage/service/azure_storage_service.rb index ff6b2be135..2867a4e441 100644 --- a/activestorage/lib/active_storage/service/azure_storage_service.rb +++ b/activestorage/lib/active_storage/service/azure_storage_service.rb @@ -83,9 +83,8 @@ module ActiveStorage def url(key, expires_in:, filename:, disposition:, content_type:) instrument :url, key: key do |payload| - base_url = url_for(key) generated_url = signer.signed_uri( - URI(base_url), false, + uri_for(key), false, service: "b", permissions: "r", expiry: format_expiry(expires_in), @@ -101,9 +100,8 @@ module ActiveStorage def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:) instrument :url, key: key do |payload| - base_url = url_for(key) generated_url = signer.signed_uri( - URI(base_url), false, + uri_for(key), false, service: "b", permissions: "rw", expiry: format_expiry(expires_in) @@ -120,8 +118,8 @@ module ActiveStorage end private - def url_for(key) - "#{blobs.host}/#{container}/#{key}" + def uri_for(key) + blobs.generate_uri("#{container}/#{key}") end def blob_for(key) -- cgit v1.2.3