#10687 closed (fixed)
request parsing breaks if upload_handlers is empty
Reported by: | Ryan Kelly | Owned by: | Armin Ronacher |
---|---|---|---|
Component: | File uploads/storage | Version: | dev |
Severity: | 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
If request.upload_handlers is empty, attempts to use MultiPartParser will fail with "TypeError: 'long' object is not iterable". This is caused by the use of min() to calculate the parser chunk size; if upload_handlers is empty then min() is called with a single argument, which it tries to interpret as an iterable.
The attached patch avoids this error and does what I think is the most sensible thing - any file uploads get discarded, but other POST variables are parsed correctly. If this is not desired, perhaps its worth checking for an empty upload_handlers and providing a better error message?
Attachments (1)
Change History (9)
by , 16 years ago
Attachment: | multipartparser.py.diff added |
---|
comment:1 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
comment:3 by , 16 years ago
Owner: | changed from | to
---|
comment:4 by , 16 years ago
Owner: | changed from | to
---|
comment:5 by , 16 years ago
Fix including testcase on github: http://github.com/mitsuhiko/django/tree/ticket-10687
comment:6 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Needs a test.