Skip to content

Commit 5fd0f56

Browse files
committed
Use proper storage facade for checking if the file exists
Signed-off-by: snipe <[email protected]>
1 parent 37d7e89 commit 5fd0f56

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

app/Http/Controllers/Users/UserFilesController.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ public function destroy($userId = null, $fileId = null)
8787

8888
$full_filename = $rel_path.'/'.$log->filename;
8989

90-
if (file_exists($full_filename)) {
91-
Storage::delete($rel_path.'/'.$log->filename);
90+
if (Storage::exists($rel_path.'/'.$full_filename)) {
91+
Storage::delete($rel_path.'/'.$full_filename);
92+
$log->delete();
9293
return redirect()->back()->with('success', trans('admin/users/message.deletefile.success'));
9394
}
94-
95-
$log->delete();
96-
return redirect()->back()->with('success', trans('admin/users/message.deletefile.success'));
9795
}
9896

9997
return redirect()->back()->with('error', trans('admin/users/general.log_does_not_exist'));

0 commit comments

Comments
 (0)