From 3e326af8ea6f8107709cfccf6563ce26475c3c8c Mon Sep 17 00:00:00 2001 From: Lonami Date: Thu, 25 Apr 2019 20:29:54 +0200 Subject: [PATCH] Fix modifying stripped sizes in place --- telethon/client/downloads.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index aa7008cd..77229641 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -342,10 +342,11 @@ class DownloadMethods(UserMethods): f = open(file, 'wb') else: f = file - if isinstance(size, types.PhotoStrippedSize): - size.bytes = utils.stripped_to_photo(size.bytes) + try: - f.write(size.bytes) + f.write(utils.stripped_photo_to_jpg(size.bytes) + if isinstance(size, types.PhotoStrippedSize) + else size.bytes) finally: if isinstance(file, str): f.close()