aboutsummaryrefslogtreecommitdiff
path: root/src/misc.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.erl')
-rw-r--r--src/misc.erl17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/misc.erl b/src/misc.erl
index 85d11da4a..6402e9419 100644
--- a/src/misc.erl
+++ b/src/misc.erl
@@ -357,18 +357,19 @@ try_url(URL0) ->
V when is_binary(V) -> binary_to_list(V);
_ -> URL0
end,
- case uri_parse(URL) of
- {ok, {Scheme, _, _, _, _, _}} when Scheme /= http, Scheme /= https ->
+ try uri_parse(URL) of
+ {ok, Scheme, _, _, _} when Scheme /= "http", Scheme /= "https" ->
?ERROR_MSG("Unsupported URI scheme: ~ts", [URL]),
erlang:error(badarg);
- {ok, {_, _, Host, _, _, _}} when Host == ""; Host == <<"">> ->
+ {ok, _, Host, _, _} when Host == ""; Host == <<"">> ->
?ERROR_MSG("Invalid URL: ~ts", [URL]),
erlang:error(badarg);
- {ok, _} ->
- iolist_to_binary(URL);
- {error, _} ->
- ?ERROR_MSG("Invalid URL: ~ts", [URL]),
- erlang:error(badarg)
+ {ok, _, _, _, _} ->
+ iolist_to_binary(URL)
+ catch
+ error:_ ->
+ ?ERROR_MSG("Invalid URL: ~ts", [URL]),
+ erlang:error(badarg)
end.
-spec css_dir() -> file:filename().