From 3d350c60870c946fa9ce73b3219918f8982c0366 Mon Sep 17 00:00:00 2001 From: Lonami Date: Sun, 16 May 2021 22:27:29 +0200 Subject: [PATCH] Don't check if offset is divisible by limit if limit is None Should fix #3058. --- telethon/client/downloads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 1bce3062..9f9f893a 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -703,7 +703,7 @@ class DownloadMethods: if chunk_size == request_size \ and offset % MIN_CHUNK_SIZE == 0 \ and stride % MIN_CHUNK_SIZE == 0 \ - and offset % limit == 0: + and (limit is None or offset % limit == 0): cls = _DirectDownloadIter self._log[__name__].info('Starting direct file download in chunks of ' '%d at %d, stride %d', request_size, offset, stride)