diff options
| author | Cody Robibero <cody@robibe.ro> | 2024-05-01 06:42:01 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-01 06:42:01 -0600 |
| commit | 1accfd79da399b80aeed4aba2fb32cd90bd8673b (patch) | |
| tree | 9b19c67c93b36b7157ef02142ca9255ac45f1cc7 /Jellyfin.Api/Controllers/ItemsController.cs | |
| parent | 1b4f5451a514861b637eeec857c9ea224a0a55a2 (diff) | |
Always attempt to get User if a user id is provided (#11471)
Diffstat (limited to 'Jellyfin.Api/Controllers/ItemsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ItemsController.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.cs index 70f805336..cd4a0a23b 100644 --- a/Jellyfin.Api/Controllers/ItemsController.cs +++ b/Jellyfin.Api/Controllers/ItemsController.cs @@ -246,9 +246,9 @@ public class ItemsController : BaseJellyfinApiController var isApiKey = User.GetIsApiKey(); // if api key is used (auth.IsApiKey == true), then `user` will be null throughout this method userId = 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 user if (!isApiKey && user is null) |
