From 20d73cae24f40a91a0d1d3409ff63273ae3de377 Mon Sep 17 00:00:00 2001 From: Ritwik Puri Date: Wed, 18 May 2022 17:39:44 +0530 Subject: [PATCH] fix: allow guests/users without desk access to upload text files (#16920) * fix: allow guests/users without desk access to upload text files * chore: update error message Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com> --- frappe/handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frappe/handler.py b/frappe/handler.py index 7b010eb716..44249323ef 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -25,6 +25,7 @@ ALLOWED_MIMETYPES = ( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.oasis.opendocument.text", "application/vnd.oasis.opendocument.spreadsheet", + "text/plain", ) @@ -202,7 +203,7 @@ def upload_file(): if not file_url and (frappe.session.user == "Guest" or (user and not user.has_desk_access())): filetype = guess_type(filename)[0] if filetype not in ALLOWED_MIMETYPES: - frappe.throw(_("You can only upload JPG, PNG, PDF, or Microsoft documents.")) + frappe.throw(_("You can only upload JPG, PNG, PDF, TXT or Microsoft documents.")) if method: method = frappe.get_attr(method)