Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#9591 closed (fixed)

MemoryFileUploadHandler doesn't rewind InMemoryUploadedFile to the beginning

Reported by: isagalaev Owned by: nobody
Component: File uploads/storage Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


MemoryFileUploadHandler creates an InMemoryUploadedFile and passes it to without doing seek(0) beforehand. This contradicts the docstring of that says "The content should be a proper File object, ready to be read from the beginning."

Patch follows.

P.S. Uploaded files are saved correctly though with the standard FileSystemStorage because it uses .chunks() method of a File object that incidentally does seek(0) before read().

Attachments (2)

9591.diff (399 bytes) - added by isagalaev 8 years ago.
9591-test.diff (2.2 KB) - added by mmarshall 7 years ago.
Simple test

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by isagalaev


comment:1 Changed 8 years ago by kratorius

  • Component changed from Uncategorized to File uploads/storage
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 8 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by bthomas

  • Has patch set

comment:4 Changed 7 years ago by mmarshall

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

This appears to be fixed. InMemoryUploadFile.init calls seek(0) on the file.

Changed 7 years ago by mmarshall

Simple test

comment:5 Changed 5 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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