0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Mimetype lookup expects lowercase extensions

We handle extensions in a case-insensitive manner when looking
for a mimetype for a file. Extensions are thus lowered.
This commit is contained in:
Loïc Hoguin 2012-10-25 17:21:14 +02:00
parent d3277b08ce
commit 5525369a4a

View file

@ -451,7 +451,7 @@ path_to_mimetypes(Filepath, Extensions) when is_binary(Filepath) ->
-spec path_to_mimetypes_(binary(), [{binary(), [mimedef()]}]) -> [mimedef()].
path_to_mimetypes_(Ext, Extensions) ->
case lists:keyfind(Ext, 1, Extensions) of
case lists:keyfind(cowboy_bstr:to_lower(Ext), 1, Extensions) of
{_, MTs} -> MTs;
_Unknown -> default_mimetype()
end.