﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35897	Template system: escape() calls in get_exception_info() should be removed	Klaas van Schelven	Klaas van Schelven	"[https://github.com/django/django/blob/042b381e2e37c0c37b8a8f6cc9947f1a2ebfa0dd/django/template/base.py#L250 Here] there are some calls to `escape()`

They shouldn't be there: escaping happens in templates for non-safe strings anyway, so there's no need.

And there _is_ a drawback: as an example, the Python Sentry SDK [https://github.com/getsentry/sentry-python/blob/200d0cdde8eed2caa89b91db8b17baabe983d2de/sentry_sdk/integrations/django/templates.py#L32 copies this info], but because it gets sent over the wire (as a JSON string) the information that this has already been escaped is lost, and on the receiving end it is escaped again.

This means that on the server-side [https://www.bugsink.com/ the Error-tracking, in my case Bugsink] will show doubly escaped html code snippets. This looks something like this:


{{{
&lt;p class=&quot;relative text-slate-600 text-base md:text-xl mb-4 md:mb-5&quot;&gt; 
}}}

Removing the calls to `escape` simply solves this. Which makes sense: calling `escape` is simply not the responsibility of this piece of code, it should just stay marked as unsafe and be escape at the edges (on rendering)."	Cleanup/optimization	closed	Error reporting	dev	Normal	fixed		Keryn Knight Florian Apolloner	Ready for checkin	1	0	0	0	0	0
