mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-31 20:24:21 -04:00
Always attempt to get User if a user id is provided (#11471)
This commit is contained in:
parent
1b4f5451a5
commit
1accfd79da
@ -246,9 +246,9 @@ public class ItemsController : BaseJellyfinApiController
|
|||||||
var isApiKey = User.GetIsApiKey();
|
var isApiKey = User.GetIsApiKey();
|
||||||
// if api key is used (auth.IsApiKey == true), then `user` will be null throughout this method
|
// if api key is used (auth.IsApiKey == true), then `user` will be null throughout this method
|
||||||
userId = RequestHelpers.GetUserId(User, userId);
|
userId = RequestHelpers.GetUserId(User, userId);
|
||||||
var user = !isApiKey && !userId.IsNullOrEmpty()
|
var user = userId.IsNullOrEmpty()
|
||||||
? _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException()
|
? null
|
||||||
: null;
|
: _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException();
|
||||||
|
|
||||||
// beyond this point, we're either using an api key or we have a valid user
|
// beyond this point, we're either using an api key or we have a valid user
|
||||||
if (!isApiKey && user is null)
|
if (!isApiKey && user is null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user