Opened 16 years ago
Closed 16 years ago
#7766 closed (duplicate)
TemporaryFileUploadHandler unlinking files before they are moved
Reported by: | screeley | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
First off I'm running Django HEAD on Ubuntu 7.04
I'm running into issues with the Upload File changes as of -r7814
The following lines in /django/db/models/base.py are causing headaches for files above the FILE_UPLOAD_MAX_MEMORY_SIZE where Django uses the TemporaryFileUploadHandler.
531 raw_field.close() 532 file_move_safe(raw_field.temporary_file_path(), full_filename)
raw_field.close() actually does an unlink on the file and deletes it from my tmp directory and once the file is gone I can no longer move it.
From the tempfile doc: "Returns an object with a file-like interface; the name of the file is accessible as file.name. The file will be automatically deleted when it is closed."
I don't really know why this close is in there. It's only used for the TemporaryUploadedFile which is the cause of the issue, InMemory just passes the close.
I would recommend getting rid of the raw_field.close(), but that throws another error that django ignores. I don't know enough about the warnings to guess how to fix that one.
Thanks!
This is already reported in #7683