Opened 8 years ago
Closed 8 years ago
#27191 closed Bug (fixed)
Generation of error reports fails if request.GET, POST, FILES or COOKIES contains key 'items'
Reported by: | Anatoly Burov | Owned by: | nobody |
---|---|---|---|
Component: | Error reporting | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When DEBUG
is True, if the request.GET
or another QueryDict contains key named 'items'
and a view raises an exception, the generation of error report fails. Due to a difference in django.views.debug.TECHNICAL_500_TEMPLATE
and TECHNICAL_500_TEXT_TEMPLATE
, the actual behaviour varies.
Normal requests
For normal requests the output is produced, but the query variables are dumped in a wrong way. For example, for request 'GET /test/?items=Oops' the dump will contain a table:
GET
Variable | Value |
O | ''
|
o | ''
|
p | ''
|
s | ''
|
This is because TECHNICAL_500_TEMPLATE
iterates QueryDict this way:
{% for var in filtered_POST.items %} ... {{ var.0 }} ... {{ var.1 }} ...
Ajax requests
For ajax requests the plain text error report generation itself raises an exception:
ValueError: Need 2 values to unpack in for loop; got 1.
The console gets flooded with the tracedumps and the upstream eventually receives a 502 Bad Gateway
.
This is because TECHNICAL_500_TEXT_TEMPLATE
iterates QueryDict this way:
{% for k, v in request.GET.items %} ... {{ k }} ... {{ v }} ...
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Component: | Uncategorized → Error reporting |
---|---|
Has patch: | set |
Triage Stage: | Unreviewed → Accepted |
PR with tests and the fix.