From 15f64fa7bc081e92ae7fca31de385df0ebb9d4a7 Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Tue, 17 Dec 2024 13:06:21 +0530 Subject: [PATCH 1/3] fix: add support for CSV files for non desk users --- frappe/handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/handler.py b/frappe/handler.py index 42b233f446..4ef8fb91dd 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -36,6 +36,7 @@ ALLOWED_MIMETYPES = ( "text/plain", "video/quicktime", "video/mp4", + "text/csv", ) From f6637d7ef07c98010a555e7b2270fdadaf6cb72a Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Tue, 17 Dec 2024 13:10:27 +0530 Subject: [PATCH 2/3] fix: change error message --- frappe/handler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frappe/handler.py b/frappe/handler.py index 4ef8fb91dd..68e96803cb 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -36,7 +36,6 @@ ALLOWED_MIMETYPES = ( "text/plain", "video/quicktime", "video/mp4", - "text/csv", ) @@ -181,7 +180,7 @@ def upload_file(): 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.")) + frappe.throw(_("You can only upload JPG, PNG, PDF, TXT, CSV or Microsoft documents.")) if method: method = frappe.get_attr(method) From 6e524ada8f1b4bea8694fcb82494cdcc15894a99 Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Tue, 17 Dec 2024 13:11:57 +0530 Subject: [PATCH 3/3] chore: code cleanup --- frappe/handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/handler.py b/frappe/handler.py index 68e96803cb..64b15ccc7d 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -36,6 +36,7 @@ ALLOWED_MIMETYPES = ( "text/plain", "video/quicktime", "video/mp4", + "text/csv", )