24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

mod_http_upload: Don't flatten command strings

This commit is contained in:
Holger Weiss 2015-11-09 18:50:45 +01:00
parent 9c80cb2b26
commit 842db2ca15

View File

@ -876,8 +876,7 @@ code_to_message(_Code) -> <<"">>.
-spec identify(binary()) -> {ok, media_info()} | pass. -spec identify(binary()) -> {ok, media_info()} | pass.
identify(Path) -> identify(Path) ->
Cmd = lists:flatten(io_lib:fwrite("identify -format \"ok %m %h %w\" ~s", Cmd = io_lib:fwrite("identify -format \"ok %m %h %w\" ~s", [Path]),
[Path])),
Res = string:strip(os:cmd(Cmd), right, $\n), 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] ->
@ -902,8 +901,7 @@ convert(Path, #media_info{type = T, width = W, height = H}) ->
Dir = filename:dirname(Path), Dir = filename:dirname(Path),
FileName = <<(randoms:get_string())/binary, $., T/binary>>, FileName = <<(randoms:get_string())/binary, $., T/binary>>,
OutPath = filename:join(Dir, FileName), OutPath = filename:join(Dir, FileName),
Cmd = lists:flatten(io_lib:fwrite("convert -resize 300 ~s ~s", Cmd = io_lib:fwrite("convert -resize 300 ~s ~s", [Path, OutPath]),
[Path, OutPath])),
case os:cmd(Cmd) of case os:cmd(Cmd) of
"" -> "" ->
{ok, OutPath}; {ok, OutPath};