mirror of
https://github.com/processone/ejabberd
synced 2025-10-06 03:50:15 +02:00
Fix try_url/1 parsing of uri_parse result format, reported by Dialyzer
This commit is contained in:
parent
cff7c4c100
commit
e5b66aadaf
1 changed files with 9 additions and 8 deletions
13
src/misc.erl
13
src/misc.erl
|
@ -357,16 +357,17 @@ 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, _} ->
|
||||
{ok, _, _, _, _} ->
|
||||
iolist_to_binary(URL)
|
||||
catch
|
||||
error:_ ->
|
||||
?ERROR_MSG("Invalid URL: ~ts", [URL]),
|
||||
erlang:error(badarg)
|
||||
end.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue