Skip to content

Commit

Permalink
fix: escape HTML instead of sanitizing
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarvora committed Mar 30, 2023
1 parent 40ad983 commit a56ea73
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions frappe/www/printview.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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:
Expand All @@ -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(
"""<h1>Error</h1>
"body": f"""
<h1>Error</h1>
<p>Parameters doctype and name required</p>
<pre>%s</pre>"""
% repr(frappe.form_dict)
)
<pre>{escape_html(frappe.as_json(frappe.form_dict, indent=2))}</pre>
"""
}

if frappe.form_dict.doc:
Expand Down

0 comments on commit a56ea73

Please sign in to comment.