From a56ea73b7d048c1536bc9957ba6e9cde2d1ddc3f Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Thu, 30 Mar 2023 11:52:53 +0530 Subject: [PATCH] fix: escape HTML instead of sanitizing --- frappe/www/printview.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frappe/www/printview.py b/frappe/www/printview.py index 9fdc77a2ba..38a0409e5f 100644 --- a/frappe/www/printview.py +++ b/frappe/www/printview.py @@ -11,7 +11,7 @@ import frappe from frappe import _, get_module_path from frappe.core.doctype.access_log.access_log import make_access_log from frappe.core.doctype.document_share_key.document_share_key import is_expired -from frappe.utils import cint, sanitize_html, strip_html +from frappe.utils import cint, escape_html, strip_html from frappe.utils.jinja_globals import is_rtl if TYPE_CHECKING: @@ -27,12 +27,11 @@ def get_context(context): """Build context for print""" if not ((frappe.form_dict.doctype and frappe.form_dict.name) or frappe.form_dict.doc): return { - "body": sanitize_html( - """

Error

+ "body": f""" +

Error

Parameters doctype and name required

-
%s
""" - % repr(frappe.form_dict) - ) +
{escape_html(frappe.as_json(frappe.form_dict, indent=2))}
+ """ } if frappe.form_dict.doc: