From 64ebf979e5e77fb25ceff3d6f948cb252ffab3b4 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 25 Feb 2018 14:30:17 +0100 Subject: [PATCH] Fix file extension --- pyrogram/client/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index dd98ee2a..deb99904 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -311,7 +311,8 @@ class Client: if not file_name: file_name = "doc_{}{}".format( datetime.fromtimestamp(document.date).strftime("%Y-%m-%d_%H-%M-%S"), - mimetypes.guess_extension(document.mime_type) or ".unknown" + ".txt" if document.mime_type == "text/plain" else + mimetypes.guess_extension(document.mime_type) if document.mime_type else ".unknown" ) for i in document.attributes: