aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2017-08-26 23:15:14 +0900
committerKoichi ITO <koic.ito@gmail.com>2017-08-26 23:16:07 +0900
commit9e470b24c8869ac739a438132cdd5648bc6fe333 (patch)
treeb22eae531b819e2c40bb6f83788953c205471936
parent114d4e05900f1d3dee094338ddd764c0537f9a74 (diff)
downloadrails-9e470b24c8869ac739a438132cdd5648bc6fe333.tar.gz
rails-9e470b24c8869ac739a438132cdd5648bc6fe333.tar.bz2
rails-9e470b24c8869ac739a438132cdd5648bc6fe333.zip
Fix order of Active Storage DiskService URL parameters
`content_type` parameter is before `disposition` parameter.
-rw-r--r--activestorage/lib/active_storage/service/disk_service.rb2
-rw-r--r--activestorage/test/service/disk_service_test.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activestorage/lib/active_storage/service/disk_service.rb b/activestorage/lib/active_storage/service/disk_service.rb
index 5aa8d74a5a..f600753a08 100644
--- a/activestorage/lib/active_storage/service/disk_service.rb
+++ b/activestorage/lib/active_storage/service/disk_service.rb
@@ -66,7 +66,7 @@ module ActiveStorage
verified_key_with_expiration,
filename: filename, disposition: disposition, content_type: content_type
else
- "/rails/active_storage/disk/#{verified_key_with_expiration}/#{filename}?disposition=#{disposition}&content_type=#{content_type}"
+ "/rails/active_storage/disk/#{verified_key_with_expiration}/#{filename}?content_type=#{content_type}&disposition=#{disposition}"
end
payload[:url] = generated_url
diff --git a/activestorage/test/service/disk_service_test.rb b/activestorage/test/service/disk_service_test.rb
index f57e44536a..e07d1d88bc 100644
--- a/activestorage/test/service/disk_service_test.rb
+++ b/activestorage/test/service/disk_service_test.rb
@@ -8,7 +8,7 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
include ActiveStorage::Service::SharedServiceTests
test "url generation" do
- assert_match(/rails\/active_storage\/disk\/.*\/avatar\.png\?.+disposition=inline/,
+ assert_match(/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/,
@service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: "inline; filename=\"avatar.png\"", filename: "avatar.png", content_type: "image/png"))
end
end