mirror of
https://github.com/processone/ejabberd
synced 2025-10-04 18:29:20 +02:00
Log message when trying to execute http_api command with extra arguments
This commit is contained in:
parent
33c10867e3
commit
65a6532cd9
1 changed files with 7 additions and 5 deletions
|
@ -322,7 +322,7 @@ handle(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
|
||||||
|
|
||||||
handle2(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
|
handle2(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
|
||||||
{ArgsF, _ResultF} = ejabberd_commands:get_command_format(Call, Auth, Version),
|
{ArgsF, _ResultF} = ejabberd_commands:get_command_format(Call, Auth, Version),
|
||||||
ArgsFormatted = format_args(Args, ArgsF),
|
ArgsFormatted = format_args(Call, Args, ArgsF),
|
||||||
case ejabberd_commands:execute_command2(Call, ArgsFormatted, Auth, Version) of
|
case ejabberd_commands:execute_command2(Call, ArgsFormatted, Auth, Version) of
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
throw(Error);
|
throw(Error);
|
||||||
|
@ -346,7 +346,7 @@ get_elem_delete(A, L, F) ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
format_args(Args, ArgsFormat) ->
|
format_args(Call, Args, ArgsFormat) ->
|
||||||
{ArgsRemaining, R} = lists:foldl(fun ({ArgName,
|
{ArgsRemaining, R} = lists:foldl(fun ({ArgName,
|
||||||
ArgFormat},
|
ArgFormat},
|
||||||
{Args1, Res}) ->
|
{Args1, Res}) ->
|
||||||
|
@ -361,9 +361,11 @@ format_args(Args, ArgsFormat) ->
|
||||||
case ArgsRemaining of
|
case ArgsRemaining of
|
||||||
[] -> R;
|
[] -> R;
|
||||||
L when is_list(L) ->
|
L when is_list(L) ->
|
||||||
|
ExtraArgs = [N || {N, _} <- L],
|
||||||
|
?INFO_MSG("Command ~s call rejected, it has unknown arguments ~w",
|
||||||
|
[Call, ExtraArgs]),
|
||||||
throw({invalid_parameter,
|
throw({invalid_parameter,
|
||||||
io_lib:format("Request have unknown arguments: ~w",
|
io_lib:format("Request have unknown arguments: ~w", [ExtraArgs])})
|
||||||
[[N || {N, _} <- L]])})
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
format_arg({Elements},
|
format_arg({Elements},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue