aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations
diff options
context:
space:
mode:
authorNiels van Velzen <nielsvanvelzen@users.noreply.github.com>2026-05-06 19:07:13 +0200
committerGitHub <noreply@github.com>2026-05-06 19:07:13 +0200
commit44d59542057eaa4b7e9a9f37dfc9135744bd1628 (patch)
tree56d014513293d219e9156717172cdc9c3c58df05 /Jellyfin.Server.Implementations
parent10c42d70caffac995b14f30123c5f071f9c4a7be (diff)
parent4b8be6bc91c77f0ab451a876521c8224143b6e85 (diff)
Merge pull request #16783 from Shadowghost/fix-people-without-item-id
Fix unique people response for query if no item ID is supplied
Diffstat (limited to 'Jellyfin.Server.Implementations')
-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();