diff options
| author | Niels van Velzen <git@ndat.nl> | 2024-02-17 14:29:34 +0100 |
|---|---|---|
| committer | Niels van Velzen <git@ndat.nl> | 2024-02-17 14:29:34 +0100 |
| commit | 5b93aec2f5814f92acf3a517baf52c6e1ee952db (patch) | |
| tree | c639fc0f331d4fa963866ff9bce772e578c0d39c /Jellyfin.Api/Controllers/PlaylistsController.cs | |
| parent | 4d93f067320a83acd76f445fb0aabf828922e140 (diff) | |
Always make userId query parameter optional
Diffstat (limited to 'Jellyfin.Api/Controllers/PlaylistsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/PlaylistsController.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Jellyfin.Api/Controllers/PlaylistsController.cs b/Jellyfin.Api/Controllers/PlaylistsController.cs index 921cc6031..0e7c3f155 100644 --- a/Jellyfin.Api/Controllers/PlaylistsController.cs +++ b/Jellyfin.Api/Controllers/PlaylistsController.cs @@ -174,7 +174,7 @@ public class PlaylistsController : BaseJellyfinApiController [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult<QueryResult<BaseItemDto>> GetPlaylistItems( [FromRoute, Required] Guid playlistId, - [FromQuery, Required] Guid userId, + [FromQuery] Guid? userId, [FromQuery] int? startIndex, [FromQuery] int? limit, [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields, @@ -183,15 +183,16 @@ public class PlaylistsController : BaseJellyfinApiController [FromQuery] int? imageTypeLimit, [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes) { + userId = RequestHelpers.GetUserId(User, userId); var playlist = (Playlist)_libraryManager.GetItemById(playlistId); if (playlist is null) { return NotFound(); } - var user = userId.IsEmpty() + var user = userId.IsNullOrEmpty() ? null - : _userManager.GetUserById(userId); + : _userManager.GetUserById(userId.Value); var items = playlist.GetManageableItems().ToArray(); var count = items.Length; |
