diff --git a/pyrogram/client.py b/pyrogram/client.py index b54794fa..61722ac3 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -916,9 +916,6 @@ class Client(Methods, Scaffold): while True: chunk = r.bytes - if not chunk: - break - f.write(chunk) offset += limit @@ -938,6 +935,9 @@ class Client(Methods, Scaffold): else: await self.loop.run_in_executor(self.executor, func) + if len(chunk) < limit: + break + r = await session.send( raw.functions.upload.GetFile( location=location,