From 3e9d380e6d84638469a1c75100227892a808a4bd Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Mon, 4 May 2026 02:20:59 +0300 Subject: [PATCH] Update: 2026-05-04 02:20:59 --- app/modules_app/invoices/file.php | 14 +++++++++++++- public/shell.php | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/modules_app/invoices/file.php b/app/modules_app/invoices/file.php index af9f44e..068aa7e 100644 --- a/app/modules_app/invoices/file.php +++ b/app/modules_app/invoices/file.php @@ -24,10 +24,22 @@ if ($decoded['role'] !== 'super_admin' && $invoice['tenant_id'] !== $decoded['te } $filePath = $invoice['original_file_path']; -if (!file_exists($filePath)) die('File missing'); + +if (!file_exists($filePath)) { + error_log("FILE PROXY ERROR: File not found at " . $filePath); + header("HTTP/1.0 404 Not Found"); + exit('File missing'); +} + +if (!is_readable($filePath)) { + error_log("FILE PROXY ERROR: File not readable at " . $filePath); + header("HTTP/1.0 403 Forbidden"); + exit('Permission denied'); +} $mime = mime_content_type($filePath); header("Content-Type: $mime"); header("Content-Length: " . filesize($filePath)); +header("Cache-Control: public, max-age=3600"); // Add caching for speed readfile($filePath); exit; diff --git a/public/shell.php b/public/shell.php index 7ad69ac..5616e29 100644 --- a/public/shell.php +++ b/public/shell.php @@ -148,11 +148,11 @@ تحميل الملف 📥
-