Commit ea142d80 by pierallard Committed by Jon Yurek

Allows multiple content types for spoof detector

parent f55b9565
......@@ -31,7 +31,7 @@ module Paperclip
end
def mapping_override_mismatch?
mapped_content_type != calculated_content_type
! Array(mapped_content_type).include?(calculated_content_type)
end
def supplied_file_media_types
......
......@@ -43,4 +43,14 @@ describe Paperclip::MediaTypeSpoofDetector do
Paperclip.options[:content_type_mappings] = {}
end
end
it 'doest allow array as :content_type_mappings' do
begin
Paperclip.options[:content_type_mappings] = { html: [ "binary", "text/html" ] }
file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html").spoofed?
ensure
Paperclip.options[:content_type_mappings] = {}
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment