mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Eliminate xref warning from last commit
This commit is contained in:
parent
7897c3d0e1
commit
8d8a3177e1
1
mix.exs
1
mix.exs
@ -87,6 +87,7 @@ defmodule Ejabberd.MixProject do
|
|||||||
if_version_below('23', [{:d, :USE_OLD_PG2}]) ++
|
if_version_below('23', [{:d, :USE_OLD_PG2}]) ++
|
||||||
if_version_below('24', [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++
|
if_version_below('24', [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++
|
||||||
if_version_below('24', [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) ++
|
if_version_below('24', [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) ++
|
||||||
|
if_function_exported(:uri_string, :normalize, 1, [{:d, :HAVE_URI_STRING}])
|
||||||
if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}])
|
if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}])
|
||||||
defines = for {:d, value} <- result, do: {:d, value}
|
defines = for {:d, value} <- result, do: {:d, value}
|
||||||
result ++ [{:d, :ALL_DEFS, defines}]
|
result ++ [{:d, :ALL_DEFS, defines}]
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
{if_var_true, sip, {d, 'SIP'}},
|
{if_var_true, sip, {d, 'SIP'}},
|
||||||
{if_var_true, stun, {d, 'STUN'}},
|
{if_var_true, stun, {d, 'STUN'}},
|
||||||
{if_have_fun, {erl_error, format_exception, 6}, {d, 'HAVE_ERL_ERROR'}},
|
{if_have_fun, {erl_error, format_exception, 6}, {d, 'HAVE_ERL_ERROR'}},
|
||||||
|
{if_have_fun, {uri_string, normalize, 1}, {d, 'HAVE_URI_STRING'}},
|
||||||
{src_dirs, [src,
|
{src_dirs, [src,
|
||||||
{if_rebar3, sql},
|
{if_rebar3, sql},
|
||||||
{if_var_true, tools, tools},
|
{if_var_true, tools, tools},
|
||||||
|
24
src/rest.erl
24
src/rest.erl
@ -191,6 +191,18 @@ base_url(Server, Path) ->
|
|||||||
_ -> Url
|
_ -> Url
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-ifdef(HAVE_URI_STRING).
|
||||||
|
uri_hack(Str) ->
|
||||||
|
case uri_string:normalize("%25") of
|
||||||
|
"%" -> % This hack around bug in httpc >21 <23.2
|
||||||
|
binary:replace(Str, <<"%25">>, <<"%2525">>, [global]);
|
||||||
|
_ -> Str
|
||||||
|
end.
|
||||||
|
-else.
|
||||||
|
uri_hack(Str) ->
|
||||||
|
Str.
|
||||||
|
-endif.
|
||||||
|
|
||||||
url(Url, []) ->
|
url(Url, []) ->
|
||||||
Url;
|
Url;
|
||||||
url(Url, Params) ->
|
url(Url, Params) ->
|
||||||
@ -198,17 +210,7 @@ url(Url, Params) ->
|
|||||||
(misc:url_encode(Value))/binary>>
|
(misc:url_encode(Value))/binary>>
|
||||||
|| {Key, Value} <- Params],
|
|| {Key, Value} <- Params],
|
||||||
<<$&, Encoded0/binary>> = iolist_to_binary(L),
|
<<$&, Encoded0/binary>> = iolist_to_binary(L),
|
||||||
Encoded =
|
Encoded = uri_hack(Encoded0),
|
||||||
case erlang:function_exported(uri_string, normalize, 1) of
|
|
||||||
true ->
|
|
||||||
case uri_string:normalize("%25") of
|
|
||||||
"%" -> % This hack around bug in httpc >21 <23.2
|
|
||||||
binary:replace(Encoded0, <<"%25">>, <<"%2525">>, [global]);
|
|
||||||
_ -> Encoded0
|
|
||||||
end;
|
|
||||||
_ ->
|
|
||||||
Encoded0
|
|
||||||
end,
|
|
||||||
<<Url/binary, $?, Encoded/binary>>.
|
<<Url/binary, $?, Encoded/binary>>.
|
||||||
url(Server, Path, Params) ->
|
url(Server, Path, Params) ->
|
||||||
case binary:split(base_url(Server, Path), <<"?">>) of
|
case binary:split(base_url(Server, Path), <<"?">>) of
|
||||||
|
Loading…
Reference in New Issue
Block a user