2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Fix file extension

This commit is contained in:
Dan 2018-02-25 14:30:17 +01:00
parent 834fff88da
commit 64ebf979e5

View File

@ -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: