From: Evgeniy Khramtsov Date: Sat, 19 May 2018 15:29:33 +0000 (+0300) Subject: Correctly calculate remaining bytes on file upload X-Git-Tag: 18.06~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2114be6f333a47cc2024d2fff7d9ccedc2968d6;p=ejabberd Correctly calculate remaining bytes on file upload --- diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl index 167d2a5aa..e3cba3d95 100644 --- a/src/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -617,7 +617,7 @@ do_recv_file(Len, SockMod, Socket, Fd) -> try {ok, Data} = SockMod:recv(Socket, ChunkLen, timer:seconds(30)), ok = file:write(Fd, Data), - do_recv_file(Len-ChunkLen, SockMod, Socket, Fd) + do_recv_file(Len-size(Data), SockMod, Socket, Fd) catch _:{badmatch, {error, _} = Err} -> file:close(Fd), Err