Commit 832e0482 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'fix/warnings-photo-upload' into 'master'

Close photos after hashing their contents

See merge request !592
parents 82befdd2 de1bd9f1
...@@ -74,6 +74,7 @@ class Photo(models.Model): ...@@ -74,6 +74,7 @@ class Photo(models.Model):
hash_sha1 = hashlib.sha1() hash_sha1 = hashlib.sha1()
for chunk in iter(lambda: self.file.read(4096), b""): for chunk in iter(lambda: self.file.read(4096), b""):
hash_sha1.update(chunk) hash_sha1.update(chunk)
self.file.close()
self._digest = hash_sha1.hexdigest() self._digest = hash_sha1.hexdigest()
class Meta: class Meta:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment