Skip to content

Commit 36a94f2

Browse files
committed
Demonstrate that the correct Illustrator content type is chosen regardless of declared type when the filename extension results in a more specific subtype of the PDF type sniffed from magic bytes
1 parent cdf0e65 commit 36a94f2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/illustrator_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,14 @@ class Marcel::MimeType::IllustratorTest < Marcel::TestCase
66
file = files("name/application/illustrator/illustrator.ai")
77
assert_equal "application/illustrator", Marcel::MimeType.for(file, name: "illustrator.ai", declared_type: "application/postscript")
88
end
9+
10+
test ".ai uploaded as application/pdf" do
11+
file = files("name/application/illustrator/illustrator.ai")
12+
assert_equal "application/illustrator", Marcel::MimeType.for(file, name: "illustrator.ai", declared_type: "application/pdf")
13+
end
14+
15+
test ".ai uploaded as binary" do
16+
file = files("name/application/illustrator/illustrator.ai")
17+
assert_equal "application/illustrator", Marcel::MimeType.for(file, name: "illustrator.ai", declared_type: "application/octet-stream")
18+
end
919
end

0 commit comments

Comments
 (0)