Skip to content

The Free Software Media System - Server Backend & API

Do not return alternate versions by default

Shadowghostd5f4c624e31d
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.QueryBuilding.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.QueryBuilding.cs
index 83f108bed0..22a03dafa7 100644
--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.QueryBuilding.cs
+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.QueryBuilding.cs
@@ -439,6 +439,13 @@ public sealed partial class BaseItemRepository
|| (e.TopParentId.HasValue && f.ItemId == e.TopParentId.Value))));
}
+ // Exclude alternate versions from counts. Alternate versions have
+ // OwnerId set (pointing to their primary) but no ExtraType.
+ if (!filter.IncludeOwnedItems)
+ {
+ baseQuery = baseQuery.Where(e => e.OwnerId == null || e.ExtraType != null);
+ }
+
return baseQuery;
}