diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2018-11-28 11:26:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 11:26:26 +0900 |
commit | 74c9f649a41425ae00755eeb5369029be9497ade (patch) | |
tree | ee0e4e51297afe397299324b21afa4cf4e2de180 | |
parent | 9c4d3c341c0f09ea26a7f97a4a0af28f4e998d08 (diff) | |
parent | b7ec129de5120f8ea3b2b3562a8c38c69e508a07 (diff) | |
download | rails-74c9f649a41425ae00755eeb5369029be9497ade.tar.gz rails-74c9f649a41425ae00755eeb5369029be9497ade.tar.bz2 rails-74c9f649a41425ae00755eeb5369029be9497ade.zip |
Merge pull request #34546 from y-yagi/fix_ast_build
Fix broken ASt build
-rw-r--r-- | activestorage/test/controllers/disk_controller_test.rb | 4 | ||||
-rw-r--r-- | activestorage/test/models/blob_test.rb | 2 | ||||
-rw-r--r-- | activestorage/test/service/gcs_service_test.rb | 14 |
3 files changed, 3 insertions, 17 deletions
diff --git a/activestorage/test/controllers/disk_controller_test.rb b/activestorage/test/controllers/disk_controller_test.rb index 0aa8648db3..a723b4d56a 100644 --- a/activestorage/test/controllers/disk_controller_test.rb +++ b/activestorage/test/controllers/disk_controller_test.rb @@ -23,11 +23,11 @@ class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest assert_equal "Hello world!", response.body end - test "showing blob range inline" do + test "showing blob range" do blob = create_blob get blob.service_url, headers: { "Range" => "bytes=5-9" } assert_response :partial_content - assert_equal "inline; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] + assert_equal "attachment; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] assert_equal "text/plain", response.headers["Content-Type"] assert_equal " worl", response.body end diff --git a/activestorage/test/models/blob_test.rb b/activestorage/test/models/blob_test.rb index 0eac622d72..1503f5fc50 100644 --- a/activestorage/test/models/blob_test.rb +++ b/activestorage/test/models/blob_test.rb @@ -196,7 +196,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase filename ||= blob.filename content_type ||= blob.content_type - query = { disposition: disposition.to_s + "; #{filename.parameters}", content_type: content_type } + query = { disposition: ActionDispatch::Http::ContentDisposition.format(disposition: disposition, filename: filename.sanitized), content_type: content_type } key_params = { key: blob.key }.merge(query) "https://example.com/rails/active_storage/disk/#{ActiveStorage.verifier.generate(key_params, expires_in: 5.minutes, purpose: :blob_key)}/#{filename}?#{query.to_param}" diff --git a/activestorage/test/service/gcs_service_test.rb b/activestorage/test/service/gcs_service_test.rb index 73337ef8e1..6d0695ba58 100644 --- a/activestorage/test/service/gcs_service_test.rb +++ b/activestorage/test/service/gcs_service_test.rb @@ -84,20 +84,6 @@ if SERVICE_CONFIGURATIONS[:gcs] assert_match(/storage\.googleapis\.com\/.*response-content-disposition=inline.*test\.txt.*response-content-type=text%2Fplain/, @service.url(@key, expires_in: 2.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("test.txt"), content_type: "text/plain")) end - - test "signed URL response headers" do - begin - key = SecureRandom.base58(24) - data = "Something else entirely!" - @service.upload(key, StringIO.new(data), checksum: Digest::MD5.base64digest(data)) - - url = @service.url(key, expires_in: 2.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("test.txt"), content_type: "text/plain") - response = Net::HTTP.get_response(URI(url)) - assert_equal "text/plain", response.content_type - ensure - @service.delete key - end - end end else puts "Skipping GCS Service tests because no GCS configuration was supplied" |