From 74ef9e0a13c1805d618537393a92cd798af57a6e Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Sat, 25 May 2024 22:19:14 -0400 Subject: [PATCH] Fix backup file downloads --- app/classes/web/panel_handler.py | 10 +++++++--- app/frontend/templates/panel/server_backup_edit.html | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 04713878..e6b1f4ef 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -767,20 +767,24 @@ class PanelHandler(BaseHandler): elif page == "download_backup": file = self.get_argument("file", "") + backup_id = self.get_argument("backup_id", "") server_id = self.check_server_id() if server_id is None: return - + backup_config = self.controller.management.get_backup_config(backup_id) server_info = self.controller.servers.get_server_data_by_id(server_id) backup_file = os.path.abspath( os.path.join( - Helpers.get_os_understandable_path(server_info["backup_path"]), file + Helpers.get_os_understandable_path( + backup_config["backup_location"] + ), + file, ) ) if not self.helper.is_subdir( backup_file, - Helpers.get_os_understandable_path(server_info["backup_path"]), + Helpers.get_os_understandable_path(backup_config["backup_location"]), ) or not os.path.isfile(backup_file): self.redirect("/panel/error?error=Invalid path detected") return diff --git a/app/frontend/templates/panel/server_backup_edit.html b/app/frontend/templates/panel/server_backup_edit.html index e7e0cfe0..cffd2412 100644 --- a/app/frontend/templates/panel/server_backup_edit.html +++ b/app/frontend/templates/panel/server_backup_edit.html @@ -209,7 +209,7 @@ {% for backup in data['backup_list'] %} - {{ translate('serverBackups', 'download', data['lang']) }}