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

Merge pull request #34546 from y-yagi/fix_ast_build

Fix broken ASt build
This commit is contained in:
Yuji Yaginuma 2018-11-28 11:26:26 +09:00 committed by GitHub
commit 74c9f649a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 17 deletions

View file

@ -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

View file

@ -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}"

View file

@ -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"