Skip to content
Snippets Groups Projects
Commit 84b182f4 authored by Nathaniel Kofalt's avatar Nathaniel Kofalt
Browse files

Merge pull request #118 from scitran/fix#115

move file before db updates in container uploads
parents 5617631c 4ed7ec7f
No related branches found
No related tags found
No related merge requests found
......@@ -392,15 +392,10 @@ class FileListHandler(ListHandler):
break
else:
method = 'POST'
file_store.move_file(dest_path)
payload_validator(payload, method)
payload.update(file_properties)
result = keycheck(mongo_validator(permchecker(storage.exec_op)))(method, _id=_id, query_params=query_params, payload=payload)
if not result or result.modified_count != 1:
self.abort(404, 'Element not added in list {} of container {} {}'.format(storage.list_name, storage.cont_name, _id))
try:
file_store.move_file(dest_path)
except IOError as e:
result = keycheck(storage.exec_op)('DELETE', _id, payload=payload)
raise e
return {'modified': result.modified_count}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment