# TODO change to Content-Disposition filename https://tools.ietf.org/html/rfc6266
file_pkg = None
error_text = ""
+ fs_rollback = []
try:
if content_range_text:
content_range = (
else:
self.fs.file_delete(temp_folder, ignore_non_exist=True)
self.fs.mkdir(temp_folder)
+ fs_rollback.append(temp_folder)
storage = self.fs.get_params()
storage["folder"] = _id
current_desc["_admin"]["modified"] = time()
self.db.replace(self.topic, _id, current_desc)
self.fs.dir_rename(temp_folder, _id)
+ fs_rollback = []
indata["_id"] = _id
self._send_msg("edited", indata)
finally:
if file_pkg:
file_pkg.close()
+ for file in fs_rollback:
+ self.fs.file_delete(file, ignore_non_exist=True)
def get_file(self, session, _id, path=None, accept_header=None):
"""