From 66591b1c0d36b5ae83fd195243b9de01dfd4ef17 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Fri, 29 Jun 2018 11:06:24 +0300 Subject: Improve URLs validation --- src/mod_http_upload.erl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/mod_http_upload.erl') diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index 43a1999e1..65251e056 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -178,18 +178,14 @@ mod_opt_type(dir_mode) -> mod_opt_type(docroot) -> fun iolist_to_binary/1; mod_opt_type(put_url) -> - fun(<<"http://", _/binary>> = URL) -> URL; - (<<"https://", _/binary>> = URL) -> URL - end; + fun misc:try_url/1; mod_opt_type(get_url) -> - fun(<<"http://", _/binary>> = URL) -> URL; - (<<"https://", _/binary>> = URL) -> URL; - (undefined) -> undefined + fun(undefined) -> undefined; + (URL) -> misc:try_url(URL) end; mod_opt_type(service_url) -> - fun(<<"http://", _/binary>> = URL) -> URL; - (<<"https://", _/binary>> = URL) -> URL; - (undefined) -> undefined + fun(undefined) -> undefined; + (URL) -> misc:try_url(URL) end; mod_opt_type(custom_headers) -> fun(Headers) -> -- cgit v1.2.3