Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#11055 closed (fixed)

ImageField uploads fail at r10717

Reported by: Tim Graham Owned by: Armin Ronacher
Component: File uploads/storage Version: dev
Severity: Keywords:
Cc: Christian Hammond, eallik@…, varikin@…, albrecht.andi@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When uploading an image in the admin I get the error: Upload a valid image. The file you uploaded was either not an image or a corrupted image. r10717 seems to have introduced the bug as r10716 works fine.

Attachments (1)

11055-rewind-file.patch (485 bytes ) - added by Armin Ronacher 15 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Christian Hammond, 15 years ago

Cc: Christian Hammond added

comment:2 by anonymous, 15 years ago

I get the same problem, might have to do with http://code.djangoproject.com/ticket/8817 - which is the fix I was updating for.

comment:3 by Armin Ronacher, 15 years ago

milestone: 1.1
Owner: changed from nobody to Armin Ronacher

I have a fix for that. The behavior for rewinding slightly changed and i have to figure out how the old code was supposed to rewind.

comment:4 by Armin Ronacher, 15 years ago

Okay. The best fix is attached as diff. Previously the InMemoryUploadedFile did the rewinding, but for consistency with temporary file uploads I proposed adding the rewind to the upload finish handler.

comment:5 by Armin Ronacher, 15 years ago

Has patch: set
Needs tests: set

by Armin Ronacher, 15 years ago

Attachment: 11055-rewind-file.patch added

comment:6 by Karen Tracey, 15 years ago

Problem is broader than ImageFields, I hit it with general file upload (where I validate the content as part of cleaning the uploaded file field). I've not looked at the code at all but the attached patch does fix it for my case as well. (I'm surprised we don't have a test that caught this -- I could have sworn I've seen a test that validates uploaded content is as expected.)

comment:7 by Armin Ronacher, 15 years ago

The attached patch fixes it for any kind of upload. It was a mistake made in the refactoring of the file upload system. The patch attached reverts the old (and intended) behavior, just that the seek is now in a different function for consistency with the other upload backends.

comment:8 by Erik Allik, 15 years ago

Cc: eallik@… added

comment:9 by John Shimek, 15 years ago

Cc: varikin@… added

comment:10 by Andi Albrecht, 15 years ago

Cc: albrecht.andi@… added

comment:11 by Jacob, 15 years ago

Triage Stage: UnreviewedAccepted

comment:12 by Jacob, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in [10739].

comment:13 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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