Browse Source

Don't use string:lowercase yet, not available in OTP-19

Loïc Hoguin 6 years ago
parent
commit
ad005b7d96
2 changed files with 8 additions and 4 deletions
  1. 4 2
      src/cow_mimetypes.erl
  2. 4 2
      src/cow_mimetypes.erl.src

+ 4 - 2
src/cow_mimetypes.erl

@@ -23,7 +23,8 @@
 all(Path) ->
 all(Path) ->
 	case filename:extension(Path) of
 	case filename:extension(Path) of
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
-		<< $., Ext/binary >> -> all_ext(string:lowercase(Ext))
+		%% @todo Convert to string:lowercase on OTP-20+.
+		<< $., Ext/binary >> -> all_ext(list_to_binary(string:to_lower(binary_to_list(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 +33,8 @@ 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(string:lowercase(Ext))
+		%% @todo Convert to string:lowercase on OTP-20+.
+		<< $., Ext/binary >> -> web_ext(list_to_binary(string:to_lower(binary_to_list(Ext))))
 	end.
 	end.
 
 
 %% Internal.
 %% Internal.

+ 4 - 2
src/cow_mimetypes.erl.src

@@ -23,7 +23,8 @@
 all(Path) ->
 all(Path) ->
 	case filename:extension(Path) of
 	case filename:extension(Path) of
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
 		<<>> -> {<<"application">>, <<"octet-stream">>, []};
-		<< $., Ext/binary >> -> all_ext(string:lowercase(Ext))
+		%% @todo Convert to string:lowercase on OTP-20+.
+		<< $., Ext/binary >> -> all_ext(list_to_binary(string:to_lower(binary_to_list(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 +33,8 @@ 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(string:lowercase(Ext))
+		%% @todo Convert to string:lowercase on OTP-20+.
+		<< $., Ext/binary >> -> web_ext(list_to_binary(string:to_lower(binary_to_list(Ext))))
 	end.
 	end.
 
 
 %% Internal.
 %% Internal.