Closed danjac closed 3 months ago
Downgrading to 4.4.2 fixes the issue.
Thanks for the report. The new alerts panel should have a check for streaming responses. Do you want to submit a fix for this?
Not very familiar with the code but presumably a check needed here ?
https://github.com/jazzband/django-debug-toolbar/blob/main/debug_toolbar/panels/alerts.py#L142
def generate_stats(self, request, response):
html_content = response.content.decode(response.charset)
I wondered for a moment what's going on since we are already checking for streaming responses, but that's only when we check if we should insert the toolbar's HTML, not when generating the stats.
So yes, the generate_stats
method should probably have similar checks as well and not process streaming responses at all.
I think we would want a unit test for this as well since we didn't catch this problem in time.
I wonder if we should do something like we're doing with async and have a streaming compatible attribute on the panels that prevents the panel from attempting to process these responses.
This appears to happen when returning a
FileResponse
. The issue looks like a regression in 4.4.3.