From c37dc695922228160aec739e955ec49e39572fa2 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 23 Apr 2020 21:01:29 +0200 Subject: [PATCH] Fix downloading thumb was using name inferred for video --- telethon/client/downloads.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 23441a18..e4bb83a0 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -727,15 +727,15 @@ class DownloadMethods: if not isinstance(document, types.Document): return - kind, possible_names = self._get_kind_and_names(document.attributes) - file = self._get_proper_filename( - file, kind, utils.get_extension(document), - date=date, possible_names=possible_names - ) - if thumb is None: + kind, possible_names = self._get_kind_and_names(document.attributes) + file = self._get_proper_filename( + file, kind, utils.get_extension(document), + date=date, possible_names=possible_names + ) size = None else: + file = self._get_proper_filename(file, 'photo', '.jpg', date=date) size = self._get_thumb(document.thumbs, thumb) if isinstance(size, (types.PhotoCachedSize, types.PhotoStrippedSize)): return self._download_cached_photo_size(size, file)