diff options
| author | cvium <clausvium@gmail.com> | 2023-02-12 22:59:48 +0100 |
|---|---|---|
| committer | cvium <clausvium@gmail.com> | 2023-02-12 22:59:48 +0100 |
| commit | 52e2776d8e9390db35fc1d0c3899ed3dccad5282 (patch) | |
| tree | d59cf8572ba62ad03169833045f64b30960482c5 /Jellyfin.Api/Controllers/ItemsController.cs | |
| parent | c9aef96dba26d29df3db9e3a1ce243be23bea772 (diff) | |
| parent | 318f11e79331e4786c44734ce496eb6485201c2b (diff) | |
Merge branch 'master' into simplify_authz
# Conflicts:
# Jellyfin.Api/Auth/SyncPlayAccessPolicy/SyncPlayAccessHandler.cs
Diffstat (limited to 'Jellyfin.Api/Controllers/ItemsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ItemsController.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.cs index 97922d5db..99366e80c 100644 --- a/Jellyfin.Api/Controllers/ItemsController.cs +++ b/Jellyfin.Api/Controllers/ItemsController.cs @@ -5,6 +5,7 @@ using Jellyfin.Api.Extensions; using Jellyfin.Api.Helpers; using Jellyfin.Api.ModelBinders; using Jellyfin.Data.Enums; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -240,7 +241,7 @@ public class ItemsController : BaseJellyfinApiController var isApiKey = User.GetIsApiKey(); // if api key is used (auth.IsApiKey == true), then `user` will be null throughout this method var user = !isApiKey && userId.HasValue && !userId.Value.Equals(default) - ? _userManager.GetUserById(userId.Value) + ? _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException() : null; // beyond this point, we're either using an api key or we have a valid user @@ -814,6 +815,11 @@ public class ItemsController : BaseJellyfinApiController [FromQuery] bool excludeActiveSessions = false) { var user = _userManager.GetUserById(userId); + if (user is null) + { + return NotFound(); + } + var parentIdGuid = parentId ?? Guid.Empty; var dtoOptions = new DtoOptions { Fields = fields } .AddClientFields(User) |
