Opened 3 years ago

Closed 2 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 edevil 3 years ago.
Patch for bug
t18481_test.patch (1.1 KB) - added by hirokiky 2 years ago.
Patch for testing
18481-2.patch (1.3 KB) - added by edevil 2 years ago.
New patch that uses the standard raise format

Download all attachments as: .zip

Change History (14)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by edevil

  • Cc andre.cruz@… added

Changed 3 years ago by edevil

Patch for bug

comment:3 Changed 3 years ago by edevil

  • Has patch set

Changed 2 years ago by hirokiky

Patch for testing

comment:4 Changed 2 years ago by hirokiky

  • 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 2 years ago by edevil

New patch that uses the standard raise format

comment:5 Changed 2 years ago by edevil

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

comment:6 Changed 2 years ago by aaugustin

  • Type changed from Uncategorized to Bug

comment:7 Changed 2 years ago by anonymous

What's missing?

comment:8 Changed 2 years ago by derega

  • Needs tests set

comment:9 Changed 2 years ago by anonymous

Threre is also a patch for tests already attached.

comment:10 Changed 2 years ago by timo

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 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

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