store tmp file and move to location once done
This commit is contained in:
parent
96eabd9c8f
commit
718421988c
1 changed files with 3 additions and 1 deletions
|
@ -111,9 +111,11 @@ class Server(Resource):
|
|||
oshash = parts[-1]
|
||||
if len(oshash) == 16:
|
||||
path = self.media_path(oshash)
|
||||
tmp = path + '.tmp.webm'
|
||||
ox.makedirs(os.path.dirname(path))
|
||||
with open(path, 'wb') as f:
|
||||
with open(tmp, 'wb') as f:
|
||||
shutil.copyfileobj(request.content, f)
|
||||
shutil.move(tmp, path)
|
||||
self.update_status(oshash, 'done')
|
||||
self.upload.put(oshash)
|
||||
return self.render_json(request, {
|
||||
|
|
Loading…
Reference in a new issue