django-storages icon indicating copy to clipboard operation
django-storages copied to clipboard

Empty SpooledTemporaryFile` created when `closed` property is used multiple times

Open skylander86 opened this issue 4 years ago • 0 comments

When GoogleCloudFile's closed property is used multiple times, the spooled temporary _file is created when its previously closed. This is because https://github.com/django/django/blob/6f453cd2981525b33925faaadc7a6e51fa90df5c/django/core/files/utils.py#L53 uses self.file which triggers a creation of _file regardless. As a result, when .close() is called after, an empty file is uploaded to GS.

skylander86 avatar Apr 22 '22 07:04 skylander86