From ca9c0471b608195a6937d112381262f8ed4dc6b4 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 31 Dec 2023 08:03:19 +0000 Subject: [PATCH] Update handling of filePath argument --- ajax/system/sys_get_logfile.php | 5 +++-- app/js/custom.js | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ajax/system/sys_get_logfile.php b/ajax/system/sys_get_logfile.php index 92309696..7652092e 100644 --- a/ajax/system/sys_get_logfile.php +++ b/ajax/system/sys_get_logfile.php @@ -3,9 +3,10 @@ require '../../includes/csrf.php'; require_once '../../includes/config.php'; -$filePath = $_GET['filePath']; +$tempDir = sys_get_temp_dir(); +$filePath = $tempDir . DIRECTORY_SEPARATOR . RASPI_DEBUG_LOG; -if (isset($filePath) && strpos($filePath, RASPI_DEBUG_LOG) !== false) { +if (isset($filePath)) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($filePath)); header('Expires: 0'); diff --git a/app/js/custom.js b/app/js/custom.js index d305ae89..7c874fd6 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -270,8 +270,7 @@ function setDHCPToggles(state) { $('#debugModal').on('shown.bs.modal', function (e) { var csrfToken = $('meta[name=csrf_token]').attr('content'); $.post('ajax/system/sys_debug.php',{'csrf_token': csrfToken},function(data){ - var filePath = JSON.parse(data); - window.location.replace('/ajax/system/sys_get_logfile.php?filePath='+filePath); + window.location.replace('/ajax/system/sys_get_logfile.php'); $('#debugModal').modal('hide'); }); });