From 1fc5bb54e1ac036c44e4a6096b958f7e86674248 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 11 Nov 2024 13:50:53 +0000 Subject: [PATCH] Check that the file exists before trying to download Signed-off-by: snipe --- app/Http/Controllers/ActionlogController.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ActionlogController.php b/app/Http/Controllers/ActionlogController.php index f143c4b73b..7f86bff964 100644 --- a/app/Http/Controllers/ActionlogController.php +++ b/app/Http/Controllers/ActionlogController.php @@ -37,10 +37,18 @@ class ActionlogController extends Controller } } - public function getStoredEula($filename) : Response | BinaryFileResponse + public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse { $this->authorize('view', \App\Models\Asset::class); $file = config('app.private_uploads').'/eula-pdfs/'.$filename; - return response()->download($file); + + if (Storage::exists($file)) { + return response()->download($file); + } + + return redirect()->back()->with('error', trans('general.file_does_not_exist')); + + + } }