Don't close file prematurely

This commit is contained in:
Erik Johnston 2017-10-12 17:37:21 +01:00
parent e283b555b1
commit 802ca12d05
2 changed files with 18 additions and 8 deletions

View file

@ -275,8 +275,8 @@ class PreviewUrlResource(Resource):
)
# FIXME: pass through 404s and other error messages nicely
with open(fname) as f:
yield self.media_repo.copy_to_backup(f, fpath)
# Will close the file after its done
yield self.media_repo.copy_to_backup(open(fname), fpath)
media_type = headers["Content-Type"][0]
time_now_ms = self.clock.time_msec()