mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Correctly calculate remaining bytes on file upload
This commit is contained in:
parent
db51d522e8
commit
d2114be6f3
@ -617,7 +617,7 @@ do_recv_file(Len, SockMod, Socket, Fd) ->
|
|||||||
try
|
try
|
||||||
{ok, Data} = SockMod:recv(Socket, ChunkLen, timer:seconds(30)),
|
{ok, Data} = SockMod:recv(Socket, ChunkLen, timer:seconds(30)),
|
||||||
ok = file:write(Fd, Data),
|
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} ->
|
catch _:{badmatch, {error, _} = Err} ->
|
||||||
file:close(Fd),
|
file:close(Fd),
|
||||||
Err
|
Err
|
||||||
|
Loading…
Reference in New Issue
Block a user