diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 562a6d7e..a2bf5e85 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -1226,8 +1226,8 @@ class TelegramClient(TelegramBareClient): attr_dict[DocumentAttributeVideo] = doc else: attr_dict = { - DocumentAttributeFilename: - DocumentAttributeFilename('unnamed') + DocumentAttributeFilename: DocumentAttributeFilename( + getattr(file, 'name', None) or 'unnamed') } if 'is_voice_note' in kwargs: