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:
parent
f6b66cd130
commit
d29795fb24
|
@ -840,7 +840,7 @@ code_to_message(_Code) -> <<"">>.
|
||||||
identify(Path) ->
|
identify(Path) ->
|
||||||
Cmd = lists:flatten(io_lib:fwrite("identify -format \"ok %m %h %w\" ~s",
|
Cmd = lists:flatten(io_lib:fwrite("identify -format \"ok %m %h %w\" ~s",
|
||||||
[Path])),
|
[Path])),
|
||||||
Res = os:cmd(Cmd),
|
Res = string:strip(os:cmd(Cmd), right, $\n),
|
||||||
case string:tokens(Res, " ") of
|
case string:tokens(Res, " ") of
|
||||||
["ok", T, H, W] ->
|
["ok", T, H, W] ->
|
||||||
{ok, #media_info{
|
{ok, #media_info{
|
||||||
|
@ -871,7 +871,7 @@ convert(Path, #media_info{type = T, width = W, height = H}) ->
|
||||||
{ok, OutPath};
|
{ok, OutPath};
|
||||||
Err ->
|
Err ->
|
||||||
?ERROR_MSG("failed to convert ~s to ~s: ~s",
|
?ERROR_MSG("failed to convert ~s to ~s: ~s",
|
||||||
[Path, OutPath, Err]),
|
[Path, OutPath, string:strip(Err, right, $\n)]),
|
||||||
pass
|
pass
|
||||||
end;
|
end;
|
||||||
true ->
|
true ->
|
||||||
|
|
Loading…
Reference in New Issue