From 5fd0f562583e43f5741873dabbe3bf0bd97369d3 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 22 May 2024 17:38:49 +0100 Subject: [PATCH] Use proper storage facade for checking if the file exists Signed-off-by: snipe --- app/Http/Controllers/Users/UserFilesController.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Users/UserFilesController.php b/app/Http/Controllers/Users/UserFilesController.php index db6873a8a3..adc387fe32 100644 --- a/app/Http/Controllers/Users/UserFilesController.php +++ b/app/Http/Controllers/Users/UserFilesController.php @@ -87,13 +87,11 @@ class UserFilesController extends Controller $full_filename = $rel_path.'/'.$log->filename; - if (file_exists($full_filename)) { - Storage::delete($rel_path.'/'.$log->filename); + if (Storage::exists($rel_path.'/'.$full_filename)) { + Storage::delete($rel_path.'/'.$full_filename); + $log->delete(); return redirect()->back()->with('success', trans('admin/users/message.deletefile.success')); } - - $log->delete(); - return redirect()->back()->with('success', trans('admin/users/message.deletefile.success')); } return redirect()->back()->with('error', trans('admin/users/general.log_does_not_exist'));