Browse Source

Lowercase file extension in cow_mimetypes

David.Gao 6 years ago
parent
commit
853efc34ba
2 changed files with 4 additions and 4 deletions
  1. 2 2
      src/cow_mimetypes.erl
  2. 2 2
      src/cow_mimetypes.erl.src

+ 2 - 2
src/cow_mimetypes.erl

@@ -23,7 +23,7 @@
 all(Path) ->
 all(Path) ->
 	case filename:extension(Path) of
 	case filename:extension(Path) of
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
-		<< $., Ext/binary >> -> all_ext(Ext)
+		<< $., Ext/binary >> -> all_ext(string:lowercase(Ext))
 	end.
 	end.
 
 
 %% @doc Return the mimetype for a Web related file by looking at its extension.
 %% @doc Return the mimetype for a Web related file by looking at its extension.
@@ -32,7 +32,7 @@ all(Path) ->
 web(Path) ->
 web(Path) ->
 	case filename:extension(Path) of
 	case filename:extension(Path) of
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
-		<< $., Ext/binary >> -> web_ext(Ext)
+		<< $., Ext/binary >> -> web_ext(string:lowercase(Ext))
 	end.
 	end.
 
 
 %% Internal.
 %% Internal.

+ 2 - 2
src/cow_mimetypes.erl.src

@@ -23,7 +23,7 @@
 all(Path) ->
 all(Path) ->
 	case filename:extension(Path) of
 	case filename:extension(Path) of
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
-		<< $., Ext/binary >> -> all_ext(Ext)
+		<< $., Ext/binary >> -> all_ext(string:lowercase(Ext))
 	end.
 	end.
 
 
 %% @doc Return the mimetype for a Web related file by looking at its extension.
 %% @doc Return the mimetype for a Web related file by looking at its extension.
@@ -32,7 +32,7 @@ all(Path) ->
 web(Path) ->
 web(Path) ->
 	case filename:extension(Path) of
 	case filename:extension(Path) of
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
-		<< $., Ext/binary >> -> web_ext(Ext)
+		<< $., Ext/binary >> -> web_ext(string:lowercase(Ext))
 	end.
 	end.
 
 
 %% Internal.
 %% Internal.