mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix support logs download issues
This commit is contained in:
parent
fff186e547
commit
e3d289e6fd
@ -82,8 +82,16 @@ class Controller:
|
||||
if exec_user["preparing"]:
|
||||
return
|
||||
self.users.set_prepare(exec_user["user_id"])
|
||||
# Delete previous instace of logs
|
||||
self.del_support_file(exec_user["support_logs"])
|
||||
logger.info("Checking for previous support logs.")
|
||||
if exec_user["support_logs"] != "":
|
||||
logger.info(
|
||||
f"Found previous support log request at {exec_user['support_logs']}"
|
||||
)
|
||||
if self.helper.validate_traversal(
|
||||
tempfile.gettempdir(), exec_user["support_logs"]
|
||||
):
|
||||
logger.debug("No transversal detected. Going for the delete.")
|
||||
self.del_support_file(exec_user["support_logs"])
|
||||
# pausing so on screen notifications can run for user
|
||||
time.sleep(7)
|
||||
self.helper.websocket_helper.broadcast_user(
|
||||
@ -177,6 +185,9 @@ class Controller:
|
||||
def del_support_file(self, temp_zip_storage):
|
||||
try:
|
||||
FileHelpers.del_file(temp_zip_storage)
|
||||
logger.info(
|
||||
f"Old support logs successfully deleted from {temp_zip_storage}"
|
||||
)
|
||||
except FileNotFoundError:
|
||||
logger.info("No temp file found. Assuming it's already been cleaned up")
|
||||
except PermissionError:
|
||||
|
@ -1223,8 +1223,6 @@ class PanelHandler(BaseHandler):
|
||||
|
||||
elif page == "download_support_package":
|
||||
temp_zip_storage = exec_user["support_logs"]
|
||||
# We'll reset the support path for this user now.
|
||||
self.controller.users.set_support_path(exec_user["user_id"], "")
|
||||
|
||||
self.set_header("Content-Type", "application/octet-stream")
|
||||
self.set_header(
|
||||
|
Loading…
Reference in New Issue
Block a user