Skip to content

Commit

Permalink
Fix download of PhotoSizeProgressive
Browse files Browse the repository at this point in the history
Closes #1700.
  • Loading branch information
Lonami committed Feb 13, 2021
1 parent 75db9f7 commit b0158b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion telethon/client/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,11 @@ async def _download_photo(self: 'TelegramClient', photo, file, date, thumb, prog
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,
Expand All @@ -818,7 +823,7 @@ async def _download_photo(self: 'TelegramClient', photo, file, date, thumb, prog
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
Expand Down

0 comments on commit b0158b3

Please sign in to comment.