mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-24 17:29:28 +01:00
Fix try_url/1 parsing of uri_parse result format, reported by Dialyzer
This commit is contained in:
parent
cff7c4c100
commit
e5b66aadaf
17
src/misc.erl
17
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().
|
||||
|
Loading…
Reference in New Issue
Block a user