Fix video version links being read from stale serialised item data instead of the LinkedChildren table

This commit is contained in:
Shadowghost
2026-07-29 07:31:27 +02:00
parent d92e59aa72
commit 7a4271c85f
2 changed files with 21 additions and 3 deletions
@@ -134,6 +134,21 @@ public static class BaseItemMapper
if (dto is Video video)
{
video.PrimaryVersionId = entity.PrimaryVersionId;
// The LinkedChildren table is the source of truth for version links
if (entity.LinkedChildEntities is not null)
{
video.LinkedAlternateVersions = entity.LinkedChildEntities
.Where(e => e.ChildType is Database.Implementations.Entities.LinkedChildType.LinkedAlternateVersion
or Database.Implementations.Entities.LinkedChildType.AutoLinkedAlternateVersion)
.OrderBy(e => e.SortOrder)
.Select(e => new LinkedChild
{
ItemId = e.ChildId,
Type = (MediaBrowser.Controller.Entities.LinkedChildType)e.ChildType
})
.ToArray();
}
}
if (dto is IHasSeries hasSeriesName)