25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

mod_http_upload: Strip newline from command output

The list_to_integer/1 function doesn't cope with trailing newline
characters.
This commit is contained in:
Holger Weiss 2015-10-26 22:10:32 +01:00
parent 5dfd95e5a7
commit b5a09f8b15

View File

@ -838,7 +838,7 @@ code_to_message(_Code) -> <<"">>.
identify(Path) ->
Cmd = lists:flatten(io_lib:fwrite("identify -format \"ok %m %h %w\" ~s",
[Path])),
Res = os:cmd(Cmd),
Res = string:strip(os:cmd(Cmd), right, $\n),
case string:tokens(Res, " ") of
["ok", T, H, W] ->
{ok, #media_info{
@ -869,7 +869,7 @@ convert(Path, #media_info{type = T, width = W, height = H}) ->
{ok, OutPath};
Err ->
?ERROR_MSG("failed to convert ~s to ~s: ~s",
[Path, OutPath, Err]),
[Path, OutPath, string:strip(Err, right, $\n)]),
pass
end;
true ->