From dd00829f1eb8a17007bd19da3e9a02b0b99f6e99 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 19 Dec 2020 19:42:07 +0100 Subject: [PATCH] Ignore PhotoPathSize thumbnail sizes Closes #1655. --- telethon/client/downloads.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index d0fe2bac..6c61258a 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -733,6 +733,13 @@ class DownloadMethods: thumbs = list(sorted(thumbs, key=sort_thumbs)) + for i in reversed(range(len(thumbs))): + # :tl:`PhotoPathSize` is used for animated stickers preview, and the thumb is actually + # a SVG path of the outline. Users expect thumbnails to be JPEG files, so pretend this + # thumb size doesn't actually exist (#1655). + if isinstance(thumbs[i], types.PhotoPathSize): + thumbs.pop(i) + if thumb is None: return thumbs[-1] elif isinstance(thumb, int):