request parsing breaks if upload_handlers is empty
|Reported by:||rfk||Owned by:||mitsuhiko|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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?
Change History (9)
Changed 6 years ago by rfk
comment:1 Changed 6 years ago by jacob
- milestone set to 1.1
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted