Another attempt to fix backup delete issue.

This is hacky and can probably be done better.
This commit is contained in:
Andrew 2021-11-19 21:47:03 -05:00
parent 146873eb10
commit bd3da474f5
2 changed files with 4 additions and 4 deletions

View File

@ -214,8 +214,9 @@ class AjaxHandler(BaseHandler):
file_path = self.get_body_argument('file_path', default=None, strip=True)
server_id = self.get_argument('id', None)
if os.name == "nt":
file_path = file_path.replace('/', "\\")
if file_path.contains('/') or file_path('\\'):
server_info = self.controller.servers.get_server_data_by_id(server_id)
file_path = os.path.abspath(os.path.join(server_info["backup_path"], file_path))
console.warning("delete {} for server {}".format(file_path, server_id))

View File

@ -204,8 +204,7 @@
callback: function (result) {
console.log(result);
if (result == true) {
var full_path = '{{ data['server_stats']['server_id']['backup_path'] }}' + '/' + file_to_del;
del_backup(full_path, {{ data['server_stats']['server_id']['server_id'] }} );
del_backup(file_to_del, {{ data['server_stats']['server_id']['server_id'] }} );
}
}
});