From 131f021d51461efd21c89934f15e7e826ec533b8 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 22 Jul 2023 10:52:03 +0200 Subject: [PATCH] Don't attempt thumb download if there is no thumb --- telethon/client/downloads.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 3a1d4685..84a3d601 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -886,6 +886,9 @@ class DownloadMethods: else: file = self._get_proper_filename(file, 'photo', '.jpg', date=date) size = self._get_thumb(document.thumbs, thumb) + if not size or isinstance(size, types.PhotoSizeEmpty): + return + if isinstance(size, (types.PhotoCachedSize, types.PhotoStrippedSize)): return self._download_cached_photo_size(size, file)