diff --git a/app/classes/controllers/servers_controller.py b/app/classes/controllers/servers_controller.py index ca59fbdc..d929aee0 100644 --- a/app/classes/controllers/servers_controller.py +++ b/app/classes/controllers/servers_controller.py @@ -2,6 +2,7 @@ import os import logging import time import json +import pathlib import typing as t from app.classes.controllers.roles_controller import RolesController @@ -538,7 +539,14 @@ class ServersController(metaclass=Singleton): continue log_files = list( - filter(lambda val: val != latest_log_file, os.listdir(logs_path)) + filter( + lambda val: val != latest_log_file, + os.listdir( + pathlib.Path( + server["path"], os.path.split(server["log_path"])[0] + ) + ), + ) ) for log_file in log_files: log_file_path = os.path.join(logs_path, log_file) diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index 2c64f7cd..d8cd521d 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -159,7 +159,10 @@ class Controller: final_path += "_" + server["server_uuid"] os.mkdir(final_path) try: - FileHelpers.copy_file(server["log_path"], final_path) + FileHelpers.copy_file( + pathlib.Path(server["path"], server["log_path"]), + final_path, + ) except Exception as e: logger.warning(f"Failed to copy file with error: {e}") # Copy crafty logs to archive dir