Fixed #33461 -- Escaped template errors in the technical 500 debug page. #15361
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket is 33461.
I've used the reproducer from my original submission to the security address, but slightly adapted to force 2 alerts to appear, when the patch isn't in place. This has required using
html=False
in theassertNotContains
to avoid gettingdjango.test.html.HTMLParseError: ('Unexpected end tag textarea ...
I've opted to
just applyuse theescape
in the place where it's officially rendered, rather thanforce_escape
filterand risk potentially missing something (like the breaking out of the textarea!) - though it was suggested that maybeforce_escape
was enough to tackle the issue, so I'm OK with changing it if that's preferred.(Edit: oh get in the bin, flake8 and isort)
(Edit 2: oh, I forgot I was only running the single test case I added, rather than the whole suite. Oops! Guess I'll have opportunity to go and fix linters anyway, sigh ;))
(Edit 3: hey this time I ran the actual suite, and moved from
escape
toforce_escape
to restore the expected Plain Text output. Given I've had over a week to think on this, you'd think I'd have perhaps got this right first time. Dear reader, you'd be wrong, I am so fallible)(Edit 4: sigh, windows failures, and I've got no idea why!)