From c76fbe4edbecc6ef1011fc7044b1042042807df2 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 19 Feb 2024 13:05:44 +0000 Subject: [PATCH] =?UTF-8?q?Return=20404=20if=20download=20file=20isn?= =?UTF-8?q?=E2=80=99t=20found?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- app/Http/Controllers/Api/SettingsController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/SettingsController.php b/app/Http/Controllers/Api/SettingsController.php index 4cd8b8deb9..425a1859f8 100644 --- a/app/Http/Controllers/Api/SettingsController.php +++ b/app/Http/Controllers/Api/SettingsController.php @@ -267,12 +267,13 @@ class SettingsController extends Controller public function downloadBackup($file) { - $path = 'app/backups'; - if (Storage::exists($path.'/'.$file)) { + $path = storage_path('app/backups'); + + if (Storage::exists('app/backups/'.$file)) { $headers = ['ContentType' => 'application/zip']; return response()->download($path.'/'.$file, $file, $headers); } else { - return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found'))); + return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found')), 404); } }