From b0158b3f65a39ffe97349f26efa8aec5b9e6b4bf Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 13 Feb 2021 22:45:12 +0100 Subject: [PATCH] Fix download of PhotoSizeProgressive Closes #1700. --- telethon/client/downloads.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 35458d5b..3d2af555 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -810,6 +810,11 @@ class DownloadMethods: if isinstance(size, (types.PhotoCachedSize, types.PhotoStrippedSize)): return self._download_cached_photo_size(size, file) + if isinstance(size, types.PhotoSizeProgressive): + file_size = max(size.sizes) + else: + file_size = size.size + result = await self.download_file( types.InputPhotoFileLocation( id=photo.id, @@ -818,7 +823,7 @@ class DownloadMethods: thumb_size=size.type ), file, - file_size=size.size, + file_size=file_size, progress_callback=progress_callback ) return result if file is bytes else file