From 8d1b6629cb7e68ac14737ec533aa48475fa71efc Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 26 Feb 2018 14:14:44 +0100 Subject: [PATCH] Sending open()'ed files would make their name the entire path --- telethon/telegram_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 1dad2716..158855ad 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -1227,7 +1227,8 @@ class TelegramClient(TelegramBareClient): else: attr_dict = { DocumentAttributeFilename: DocumentAttributeFilename( - getattr(file, 'name', None) or 'unnamed') + os.path.basename( + getattr(file, 'name', None) or 'unnamed')) } if 'is_voice_note' in kwargs: