mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-10-09 12:16:24 +00:00
Fix LinkedAlternativeVersion validation
This commit is contained in:
parent
885b45838c
commit
826e21ecc8
2 changed files with 9 additions and 7 deletions
|
|
@ -456,6 +456,15 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
// If deleting an alternate version, re-route references to its primary
|
||||
RerouteLinkedChildReferencesAsync(alternateVideo.Id, alternateVideo.PrimaryVersionId.Value).GetAwaiter().GetResult();
|
||||
|
||||
// Remove deleted alternate from primary's LinkedAlternateVersions
|
||||
if (GetItemById(alternateVideo.PrimaryVersionId.Value) is Video primaryVideo)
|
||||
{
|
||||
primaryVideo.LinkedAlternateVersions = primaryVideo.LinkedAlternateVersions
|
||||
.Where(lc => !lc.ItemId.HasValue || !lc.ItemId.Value.Equals(alternateVideo.Id))
|
||||
.ToArray();
|
||||
primaryVideo.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
var children = item.IsFolder
|
||||
|
|
|
|||
|
|
@ -510,13 +510,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
// Skip items that are alternate versions of another video
|
||||
if (item is Video video)
|
||||
{
|
||||
// Check via PrimaryVersionId
|
||||
if (video.PrimaryVersionId.HasValue)
|
||||
{
|
||||
Logger.LogDebug("Item is an alternate version (via PrimaryVersionId), skipping deletion: {Path}", item.Path ?? item.Name);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if path is in LocalAlternateVersions of any valid child
|
||||
if (!string.IsNullOrEmpty(item.Path) && alternateVersionPaths.Contains(item.Path))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue