From 860b6351882aa0c066fc1b09daa863d0c272ba43 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 30 Jun 2019 17:30:52 +0300 Subject: [PATCH] Handle FileIdInvalidError in file transfers --- mautrix_telegram/util/file_transfer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mautrix_telegram/util/file_transfer.py b/mautrix_telegram/util/file_transfer.py index 7d0bba0f..ddd6bfc5 100644 --- a/mautrix_telegram/util/file_transfer.py +++ b/mautrix_telegram/util/file_transfer.py @@ -27,7 +27,7 @@ from telethon.tl.types import (Document, InputFileLocation, InputDocumentFileLoc TypePhotoSize, PhotoSize, PhotoCachedSize, InputPhotoFileLocation, InputPeerPhotoFileLocation) from telethon.errors import (AuthBytesInvalidError, AuthKeyInvalidError, LocationInvalidError, - SecurityError) + SecurityError, FileIdInvalidError) from mautrix_appservice import IntentAPI from ..tgclient import MautrixTelegramClient @@ -184,7 +184,7 @@ async def _unlocked_transfer_file_to_matrix(client: MautrixTelegramClient, inten try: file = await client.download_file(location) - except LocationInvalidError: + except (LocationInvalidError, FileIdInvalidError): return None except (AuthBytesInvalidError, AuthKeyInvalidError, SecurityError) as e: log.exception(f"{e.__class__.__name__} while downloading a file.")