Skip to content

Commit b7fcb5d

Browse files
authored
Fix extension name for jp2 (#85)
1 parent d2eb7c2 commit b7fcb5d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/mime.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ defmodule MIME do
9999
"image/gif" => ["gif"],
100100
"image/heic" => ["heic"],
101101
"image/heif" => ["heif"],
102-
"image/jp2" => [".jp2"],
102+
"image/jp2" => ["jp2"],
103103
"image/jpeg" => ["jpg", "jpeg"],
104104
"image/jxl" => ["jxl"],
105105
"image/png" => ["png"],

test/mime_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ defmodule MIMETest do
3030
assert extensions("application/vnd.custom+xml/extrainvalid") == []
3131
end
3232

33+
test "extensions must not lead with a dot" do
34+
for {type, exts} <- known_types(), ext <- exts do
35+
expected = String.replace_leading(ext, ".", "")
36+
assert expected == ext, "type '#{type}' includes '#{ext}', replace it with '#{expected}'."
37+
end
38+
end
39+
3340
test "type/1" do
3441
assert type("json") == "application/json"
3542
assert type("foo") == "application/octet-stream"

0 commit comments

Comments
 (0)