From 1986048d27383b0e70264583e8b6922652d6e5c4 Mon Sep 17 00:00:00 2001 From: Graham Conzett Date: Sun, 7 Oct 2018 15:22:58 -0400 Subject: 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. --- activestorage/app/controllers/active_storage/disk_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activestorage/app') diff --git a/activestorage/app/controllers/active_storage/disk_controller.rb b/activestorage/app/controllers/active_storage/disk_controller.rb index 7bd641ab9a..652084e822 100644 --- a/activestorage/app/controllers/active_storage/disk_controller.rb +++ b/activestorage/app/controllers/active_storage/disk_controller.rb @@ -61,6 +61,7 @@ class ActiveStorage::DiskController < ActiveStorage::BaseController end def acceptable_content?(token) - token[:content_type] == request.content_type && token[:content_length] == request.content_length + Mime::Type.lookup(request.content_type) == token[:content_type] && + token[:content_length] == request.content_length end end -- cgit v1.2.3 From bba5ecc923bbc8a635913c1101188163cb9699be Mon Sep 17 00:00:00 2001 From: Graham Conzett Date: Mon, 8 Oct 2018 09:50:51 -0400 Subject: Use content_mime_type --- activestorage/app/controllers/active_storage/disk_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activestorage/app') diff --git a/activestorage/app/controllers/active_storage/disk_controller.rb b/activestorage/app/controllers/active_storage/disk_controller.rb index 652084e822..99982202dd 100644 --- a/activestorage/app/controllers/active_storage/disk_controller.rb +++ b/activestorage/app/controllers/active_storage/disk_controller.rb @@ -61,7 +61,6 @@ class ActiveStorage::DiskController < ActiveStorage::BaseController end def acceptable_content?(token) - Mime::Type.lookup(request.content_type) == token[:content_type] && - token[:content_length] == request.content_length + token[:content_type] == request.content_mime_type && token[:content_length] == request.content_length end end -- cgit v1.2.3