aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
diff options
context:
space:
mode:
authorKGT1 <kilian.gamn@gmx.de>2026-05-03 22:35:57 +0200
committerGitHub <noreply@github.com>2026-05-03 22:35:57 +0200
commit4464b2e2ed9d8cc3f4c520ee76dfedac3557cf0d (patch)
tree4fdf6dc5fff74c21b3b2cd74c1d3d5fd695b0638 /MediaBrowser.Controller/Entities/LinkedChildComparer.cs
parent950c6525d1ab456115c4ee80b8fed86c5a81eaf5 (diff)
parent622947e37425f3620432995cde5d4a0809d91694 (diff)
Merge branch 'jellyfin:master' into removeGenericConfigurationEndpoint
Diffstat (limited to 'MediaBrowser.Controller/Entities/LinkedChildComparer.cs')
-rw-r--r--MediaBrowser.Controller/Entities/LinkedChildComparer.cs23
1 files changed, 20 insertions, 3 deletions
diff --git a/MediaBrowser.Controller/Entities/LinkedChildComparer.cs b/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
index 4f13ac61fe..8b611345f4 100644
--- a/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
+++ b/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
@@ -19,17 +19,34 @@ namespace MediaBrowser.Controller.Entities
public bool Equals(LinkedChild x, LinkedChild y)
{
- if (x.Type == y.Type)
+ if (x.Type != y.Type)
{
- return _fileSystem.AreEqual(x.Path, y.Path);
+ return false;
}
- return false;
+ // Compare by ItemId first (preferred)
+ if (x.ItemId.HasValue && y.ItemId.HasValue)
+ {
+ return x.ItemId.Value.Equals(y.ItemId.Value);
+ }
+
+#pragma warning disable CS0618 // Type or member is obsolete - fallback for shortcut/legacy comparison
+ // Fall back to Path comparison for shortcuts and legacy data
+ return _fileSystem.AreEqual(x.Path, y.Path);
+#pragma warning restore CS0618
}
public int GetHashCode(LinkedChild obj)
{
+ // Use ItemId for hash if available, otherwise fall back to legacy fields
+ if (obj.ItemId.HasValue && !obj.ItemId.Value.Equals(Guid.Empty))
+ {
+ return HashCode.Combine(obj.ItemId.Value, obj.Type);
+ }
+
+#pragma warning disable CS0618 // Type or member is obsolete - fallback for shortcut/legacy hashing
return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(StringComparison.Ordinal);
+#pragma warning restore CS0618
}
}
}