aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-05-05 20:21:44 +0200
committerShadowghost <Ghost_of_Stone@web.de>2026-05-05 20:21:44 +0200
commit4b8be6bc91c77f0ab451a876521c8224143b6e85 (patch)
tree428e652d4008a3d581041980424aefd394422cf7
parent4178e0ebaf2ff7162f474e17e27cd5bbbfafd548 (diff)
Fix unique people response for query if no item ID is supplied
-rw-r--r--Jellyfin.Server.Implementations/Item/PeopleRepository.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs
index cfc4eb2162..8d30513cc8 100644
--- a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs
+++ b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs
@@ -44,7 +44,15 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I
}
else
{
- dbQuery = dbQuery.OrderBy(e => e.Name);
+ // The Peoples table has one row per (Name, PersonType), so the same person can
+ // appear multiple times (e.g. as Actor and GuestStar). Collapse to one row per
+ // name so /Persons doesn't return the same BaseItem id repeatedly.
+ var representativeIds = dbQuery
+ .GroupBy(e => e.Name)
+ .Select(g => g.Min(e => e.Id));
+ dbQuery = context.Peoples.AsNoTracking()
+ .Where(p => representativeIds.Contains(p.Id))
+ .OrderBy(e => e.Name);
}
var count = dbQuery.Count();