From 704a7e425ca99af1b778c764a86e5388647631dd Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 13 Nov 2017 16:36:39 -0500 Subject: Preserve existing metadata when analyzing a blob Closes #31138. --- activestorage/test/test_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activestorage/test/test_helper.rb') diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb index 38408cdad3..55da781f2a 100644 --- a/activestorage/test/test_helper.rb +++ b/activestorage/test/test_helper.rb @@ -45,8 +45,8 @@ class ActiveSupport::TestCase ActiveStorage::Blob.create_after_upload! io: StringIO.new(data), filename: filename, content_type: content_type end - def create_file_blob(filename: "racecar.jpg", content_type: "image/jpeg") - ActiveStorage::Blob.create_after_upload! io: file_fixture(filename).open, filename: filename, content_type: content_type + def create_file_blob(filename: "racecar.jpg", content_type: "image/jpeg", metadata: nil) + ActiveStorage::Blob.create_after_upload! io: file_fixture(filename).open, filename: filename, content_type: content_type, metadata: metadata end def create_blob_before_direct_upload(filename: "hello.txt", byte_size:, checksum:, content_type: "text/plain") -- cgit v1.2.3 From 2d20a7696a761b1840bc2fbe09a2fd4bff2a779f Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 20 Nov 2017 10:52:54 -0500 Subject: Fix direct uploads to local service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable CSRF protection for ActiveStorage::DiskController#update. The local disk service is intended to imitate a third-party service like S3 or GCS, so we don't care where direct uploads originate: they’re authorized by signed tokens. Closes #30290. [Shinichi Maeshima & George Claghorn] --- activestorage/test/test_helper.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activestorage/test/test_helper.rb') diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb index 55da781f2a..aaf1d452ea 100644 --- a/activestorage/test/test_helper.rb +++ b/activestorage/test/test_helper.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +ENV["RAILS_ENV"] ||= "test" require_relative "dummy/config/environment.rb" require "bundler/setup" -- cgit v1.2.3