aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test
diff options
context:
space:
mode:
authorGraham Conzett <gconzett@orangebarrelmedia.com>2018-10-07 15:22:58 -0400
committerGraham Conzett <gconzett@orangebarrelmedia.com>2018-10-07 16:07:09 -0400
commit1986048d27383b0e70264583e8b6922652d6e5c4 (patch)
treeafbb5705df72567f6fc157f8804e86a908f1a377 /activestorage/test
parent4429540995b061cf120b6468ce76cbb44fcaba9c (diff)
downloadrails-1986048d27383b0e70264583e8b6922652d6e5c4.tar.gz
rails-1986048d27383b0e70264583e8b6922652d6e5c4.tar.bz2
rails-1986048d27383b0e70264583e8b6922652d6e5c4.zip
Fix issue ActiveStorage direct upload disk
Fix an issue in ActiveStorage where a direct upload to disk storage would fail due to a content type mismatch if the file was uploaded using a mime-type synonym.
Diffstat (limited to 'activestorage/test')
-rw-r--r--activestorage/test/controllers/disk_controller_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activestorage/test/controllers/disk_controller_test.rb b/activestorage/test/controllers/disk_controller_test.rb
index 4bc61d13f3..7b5e989699 100644
--- a/activestorage/test/controllers/disk_controller_test.rb
+++ b/activestorage/test/controllers/disk_controller_test.rb
@@ -67,6 +67,16 @@ class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest
assert_not blob.service.exist?(blob.key)
end
+ test "directly uploading blob with different but equivalent content type" do
+ data = "Something else entirely!"
+ blob = create_blob_before_direct_upload(
+ byte_size: data.size, checksum: Digest::MD5.base64digest(data), content_type: "application/x-gzip")
+
+ put blob.service_url_for_direct_upload, params: data, headers: { "Content-Type" => "application/x-gzip" }
+ assert_response :no_content
+ assert_equal data, blob.download
+ end
+
test "directly uploading blob with mismatched content length" do
data = "Something else entirely!"
blob = create_blob_before_direct_upload byte_size: data.size - 1, checksum: Digest::MD5.base64digest(data)