aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/TvShowsController.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2024-04-14 08:18:36 -0600
committerGitHub <noreply@github.com>2024-04-14 08:18:36 -0600
commit6fb6b5f1766a1f37a61b9faaa40209bab995bf30 (patch)
treef169e72afeda371db2ffeb1b47c4dd88a03b4744 /Jellyfin.Api/Controllers/TvShowsController.cs
parent9a4db8008593647cb6728b10317680dd3152c934 (diff)
Validate item access (#11171)
Diffstat (limited to 'Jellyfin.Api/Controllers/TvShowsController.cs')
-rw-r--r--Jellyfin.Api/Controllers/TvShowsController.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Jellyfin.Api/Controllers/TvShowsController.cs b/Jellyfin.Api/Controllers/TvShowsController.cs
index 3d84b61bf..68b4b6b8b 100644
--- a/Jellyfin.Api/Controllers/TvShowsController.cs
+++ b/Jellyfin.Api/Controllers/TvShowsController.cs
@@ -234,7 +234,7 @@ public class TvShowsController : BaseJellyfinApiController
if (seasonId.HasValue) // Season id was supplied. Get episodes by season id.
{
- var item = _libraryManager.GetItemById(seasonId.Value);
+ var item = _libraryManager.GetItemById<BaseItem>(seasonId.Value);
if (item is not Season seasonItem)
{
return NotFound("No season exists with Id " + seasonId);
@@ -244,7 +244,8 @@ public class TvShowsController : BaseJellyfinApiController
}
else if (season.HasValue) // Season number was supplied. Get episodes by season number
{
- if (_libraryManager.GetItemById(seriesId) is not Series series)
+ var series = _libraryManager.GetItemById<Series>(seriesId);
+ if (series is null)
{
return NotFound("Series not found");
}
@@ -259,7 +260,7 @@ public class TvShowsController : BaseJellyfinApiController
}
else // No season number or season id was supplied. Returning all episodes.
{
- if (_libraryManager.GetItemById(seriesId) is not Series series)
+ if (_libraryManager.GetItemById<BaseItem>(seriesId) is not Series series)
{
return NotFound("Series not found");
}
@@ -342,13 +343,13 @@ public class TvShowsController : BaseJellyfinApiController
var user = userId.IsNullOrEmpty()
? null
: _userManager.GetUserById(userId.Value);
-
- if (_libraryManager.GetItemById(seriesId) is not Series series)
+ var item = _libraryManager.GetItemById<Series>(seriesId, user);
+ if (item is null)
{
- return NotFound("Series not found");
+ return NotFound();
}
- var seasons = series.GetItemList(new InternalItemsQuery(user)
+ var seasons = item.GetItemList(new InternalItemsQuery(user)
{
IsMissing = isMissing,
IsSpecialSeason = isSpecialSeason,