Close version file object using a context manager

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-05-13 23:44:08 -04:00
parent a69e74ac90
commit a0b4d38d19

View File

@@ -329,8 +329,8 @@ class DocumentVersion(models.Model):
Save a copy of the document from the document storage backend
to the local filesystem
"""
input_file_object = self.open()
shutil.copyfileobj(fsrc=input_file_object, fdst=file_object)
with self.open() as input_file_object:
shutil.copyfileobj(fsrc=input_file_object, fdst=file_object)
@property
def size(self):