Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#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)

multipartparser.py.diff (747 bytes ) - added by Ryan Kelly 16 years ago.

Download all attachments as: .zip

Change History (9)

by Ryan Kelly, 16 years ago

Attachment: multipartparser.py.diff added

comment:1 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 by Jacob, 16 years ago

Needs a test.

comment:3 by Arthur Koziel, 16 years ago

Owner: changed from nobody to Arthur Koziel

comment:4 by Armin Ronacher, 16 years ago

Owner: changed from Arthur Koziel to Armin Ronacher

comment:5 by Armin Ronacher, 16 years ago

comment:6 by Jacob, 16 years ago

Resolution: fixed
Status: newclosed

(In [10723]) Fixed #10687: fixed request parsing when upload_handlers is empty. Thanks, Armin Ronacher.

comment:7 by Jacob, 16 years ago

(In [10765]) [1.0.X] Fixed #10687: fixed request parsing when upload_handlers is empty. Thanks, Armin Ronacher. Backport of [10723] from trunk.

comment:8 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top