Skip to content


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

wants to merge 1 commit into from

2 participants


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

Django member

Any possibility of adding a test for this?


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.

Django member

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/
1 django/core/files/
@@ -215,6 +215,7 @@ def _save(self, name, content):
_file = os.fdopen(fd, mode)
+ content.close()
if _file is not None:
Something went wrong with that request. Please try again.