Code

Opened 6 years ago

Closed 6 years ago

#7766 closed (duplicate)

TemporaryFileUploadHandler unlinking files before they are moved

Reported by: screeley Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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!

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by Karen Tracey <kmtracey@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This is already reported in #7683

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.