3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-03-06 16:38:17 +00:00

Reversed order of find

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2023-10-09 16:43:14 +01:00
parent e3591dc756
commit f685ba01b6
6 changed files with 11 additions and 6 deletions

View File

@ -136,6 +136,11 @@ class UserFilesController extends Controller
*/
public function show($userId = null, $fileId = null)
{
if (empty($fileId)) {
return redirect()->route('users.show')->with('error', 'Invalid file request');
}
$user = User::find($userId);
// the license is valid
@ -143,7 +148,7 @@ class UserFilesController extends Controller
$this->authorize('view', $user);
if ($log = Actionlog::find($fileId)->whereNotNull('filename')->where('item_id', $user->id)->first()) {
if ($log = Actionlog::whereNotNull('filename')->where('item_id', $user->id)->find($fileId)) {
// Display the file inline
if (request('inline') == 'true') {