diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-26 22:10:32 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-26 22:10:32 +0100 |
commit | b5a09f8b1594f5775c48870032cfc702e0ca6017 (patch) | |
tree | 8c86e7882c7c0482d7431b3f33cdcaac60808568 | |
parent | Support user quotas for HTTP File Upload (diff) |
mod_http_upload: Strip newline from command output
The list_to_integer/1 function doesn't cope with trailing newline
characters.
-rw-r--r-- | src/mod_http_upload.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index 40f194be..88ca53f7 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -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 -> |