Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed #21057: FileSystemStorage can leave temporary files around. #1571

Closed
wants to merge 1 commit into from

2 participants

@cabincode

This patch makes sure that the uploaded file is always closed, ensuring that temporary files get cleaned up.

@timgraham
Owner

Any possibility of adding a test for this?

@cabincode

I don't see how, unfortunately -- as noted in the ticket, I only see the debris under uWSGI, in a production configuration. The temporary file is cleaned up quickly under the dev server. I think you'd have to perturb the test setup so much that the test wouldn't have any value.

@timgraham
Owner

All right, that's what I figured.

merged in 30fc49a

@timgraham timgraham closed this
@cabincode cabincode deleted the unknown repository branch
@cabincode cabincode restored the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 6, 2013
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  django/core/files/storage.py
View
1  django/core/files/storage.py
@@ -215,6 +215,7 @@ def _save(self, name, content):
_file = os.fdopen(fd, mode)
_file.write(chunk)
finally:
+ content.close()
locks.unlock(fd)
if _file is not None:
_file.close()
Something went wrong with that request. Please try again.