From a9fd5f50017491de4a8576364c20a3ac2d77f3ea Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Mon, 11 Jul 2022 14:23:10 +0530 Subject: [PATCH] fix: dont allow blank content of unsupported type --- frappe/handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frappe/handler.py b/frappe/handler.py index b1bbb6bf10..cee6d3fbde 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -206,7 +206,9 @@ def upload_file(): frappe.local.uploaded_file = content frappe.local.uploaded_filename = filename - if content and (frappe.session.user == "Guest" or (user and not user.has_desk_access())): + if content is not None 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, TXT or Microsoft documents."))