Opened 4 years ago

Closed 4 years ago

#18481 closed Bug (fixed)

IOErrors from FILES are not wrapped with UnreadablePostError

Reported by: KyleMac Owned by: nobody
Component: HTTP handling Version: 1.4
Severity: Normal Keywords:
Cc: andre.cruz@…, hirokiky@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Ticket #17277 wrapped IOErrors when reading the POST body with the custom exception UnreadablePostError in order to make them easily identifiable and thus easily ignored. However the same is not done when reading FILES fails and a raw IOError is still raised.

Outside of AJAX it's failed file uploads that raise the most IOErrors and so UnreadablePostError is not currently very useful.

Attachments (3)

18481.patch (900 bytes) - added by André Cruz 4 years ago.
Patch for bug
t18481_test.patch (1.1 KB) - added by Hiroki Kiyohara 4 years ago.
Patch for testing
18481-2.patch (1.3 KB) - added by André Cruz 4 years ago.
New patch that uses the standard raise format

Download all attachments as: .zip

Change History (14)

comment:1 Changed 4 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by André Cruz

Cc: andre.cruz@… added

Changed 4 years ago by André Cruz

Attachment: 18481.patch added

Patch for bug

comment:3 Changed 4 years ago by André Cruz

Has patch: set

Changed 4 years ago by Hiroki Kiyohara

Attachment: t18481_test.patch added

Patch for testing

comment:4 Changed 4 years ago by Hiroki Kiyohara

Cc: hirokiky@… added

I uploaded a patch about testing for this bug.

The testing was successful.
I applied the edevil's patch and run the testing with Python 2.7.1 and 3.3.

Changed 4 years ago by André Cruz

Attachment: 18481-2.patch added

New patch that uses the standard raise format

comment:5 Changed 4 years ago by André Cruz

I added a new patch that re-raises the exception in the standard format seen on the rest of the codebase.

comment:6 Changed 4 years ago by Aymeric Augustin

Type: UncategorizedBug

comment:7 Changed 4 years ago by anonymous

What's missing?

comment:8 Changed 4 years ago by Ilkka Hakkari

Needs tests: set

comment:9 Changed 4 years ago by anonymous

Threre is also a patch for tests already attached.

comment:10 Changed 4 years ago by Tim Graham

I believe this pull request is the same as the second patch, however, it doesn't have any tests (django/http/request.py is the only modified file).

https://github.com/django/django/pull/675

comment:11 Changed 4 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In de66b56790598f2ff97b8df859356d755ce64e20:

Fixed #18481 -- Wrapped request.FILES read error in UnreadablePostError

Thanks KyleMac for the report, André Cruz for the initial patch and
Hiroki Kiyohara for the tests.

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