The Free Software Media System - Server Backend & API
Always attempt to get User if a user id is provided (#11471)
Cody Robibero1accfd79da39
diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.csindex 70f805336b..cd4a0a23b1 100644--- a/Jellyfin.Api/Controllers/ItemsController.cs+++ b/Jellyfin.Api/Controllers/ItemsController.cs@@ -246,9 +246,9 @@ public class ItemsController : BaseJellyfinApiControllervar isApiKey = User.GetIsApiKey();// if api key is used (auth.IsApiKey == true), then `user` will be null throughout this methoduserId = RequestHelpers.GetUserId(User, userId);- var user = !isApiKey && !userId.IsNullOrEmpty()- ? _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException()- : null;+ var user = userId.IsNullOrEmpty()+ ? null+ : _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException();// beyond this point, we're either using an api key or we have a valid userif (!isApiKey && user is null)