aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/UserDataManager.cs
AgeCommit message (Collapse)Author
4 daysfix: avoid NRE when sorting by user-dependent keys without a userPaolo Antinori
A query sorted by a user-dependent key (PlayCount, IsFavoriteOrLiked, DatePlayed, IsPlayed, IsUnplayed) but carrying no User caused a NullReferenceException inside UserDataManager.GetUserData, surfacing as "Failed to compare two elements in the array" (InvalidOperationException wrapping the NRE from the LINQ sort) and 500-ing the /Items request. Root cause: LibraryManager.GetComparer assigned comparer.User = user without a null guard, so PlayCountComparer.GetValue called UserDataManager.GetUserData(null, item), dereferencing user.Id. Two-part fix: - LibraryManager.GetComparer: when user is null and the sort key requires a user (IUserBaseItemComparer), substitute the SortName comparer so the result stays deterministic instead of 500-ing. SortName is the project's canonical tiebreaker (ItemsController injects it for album-by-artist). - UserDataManager.GetUserData: ArgumentNullException.ThrowIfNull(user) as defense in depth (matches the existing guards on the SaveUserData overloads in the same file). On master this overload was rewritten to use ResolveUserDataRow, so the NRE dereferences user.Id rather than user.InternalId as on the release branch — same bug, different line. Also fixes DateLastMediaAddedComparer being statically mis-tagged as IUserBaseItemComparer: its GetDate is static and never reads User, so it does not need one. Without this, the SortName fallback above would wrongly engage for DateLastContentAdded on anonymous queries (returning SortName order instead of date order). Re-tagged to IBaseItemComparer and dropped the unused User/UserManager/UserDataManager properties. Tests: - UserDataManagerTests.GetUserData_NullUser_ThrowsArgumentNullException: reproduces the crash (NRE -> now ArgumentNullException). Added to master's existing UserDataManagerTests. - LibraryManagerSortTests.Sort_UserDependentKey_NullUser_FallsBackToSortNameWithoutThrowing: Sort with a user-dependent key + null user no longer throws and returns items ordered by the SortName fallback (direction preserved). - LibraryManagerSortTests.Sort_DateLastContentAdded_NullUser_OrdersByDateNotSortName: guards that DateLastContentAdded still sorts by date with no user (fixture chosen so date-desc and SortName-desc disagree, so a revert is caught). Full Jellyfin.Server.Implementations.Tests suite: 642 passed, 0 failed. Fixes #17393
6 daysMerge pull request #17320 from TaterTechStudios/fix/item-correct-selectorCody Robibero
Fix: Fetch the correct row matching the most up to date file
10 daysFix user data batch query perfShadowghost
11 daysMove GetUserDataBatch to use ResolveUserDataRow when item.UserData isn't ↵Jordan Rushing
preloaded
13 daysFix: Fetch the correct row matching the most up to date fileJordan Rushing
2026-07-02Fix review commentsShadowghost
2026-06-19Surface the played version for resumeShadowghost
2026-06-12Fix performanceShadowghost
2026-06-09Coalesce alternate-version progress onto primary in resume filterShadowghost
2026-06-07Add version-aware playback trackingShadowghost
2026-04-19Fix too many SQL variables error on large librariesShadowghost
2026-01-18Simplify UserDataManager and remove unused private methodsShadowghost
Removes unused private GetUserData and GetUserDataInternal methods. Moves GetUserDataBatch to be an abstract interface method rather than having a default implementation for clarity.
2025-09-22Fix groupings not applied (#14826)JPVenson
2025-09-16Optimize internal querying of UserData, other fixes (#14795)JPVenson
2025-09-11 Add 1-second tolerance to resume playback completion check (#14774)theguymadmax
2025-03-27Implement limiting caches (#13605)Cody Robibero
* Implement basic expiring cache for LibraryManager * Add expiring cache to more places * Rider why * Make DirectoryService caches static * Use FastConcurrentLru * Reduce default cache size * Simplify DirectoryService caches * Make directory service cache size at least 128
2025-03-25Fixed namespacesJPVenson
2025-03-25WIP fixed namespacesJPVenson
2025-01-18applied review commentsJPVenson
2025-01-17worsen commentJPVenson
2025-01-15Applied review commentsJPVenson
2024-11-17Merge branch 'master' into feature/EFUserDataJPVenson
2024-11-16Update projects to .NET 9 (#13023)Bond-009
2024-11-14Fixed Transaction for UserdataJPVenson
2024-11-12Fixed userdata lookupJPVenson
2024-11-11Fixed Duplicate returns on groupingJPVenson
Fixed UserDataKey not stored
2024-11-11Fixed TopParent not beeing migratedJPVenson
2024-10-22Reodered Context creationJPVenson
2024-10-20Fixed testsJPVenson
2024-10-20i have too much time.JPVenson
Refactored BaseItem and UserData relation
2024-09-07Migrated UserData from library sqlite db to jellyfin.dbJPVenson
2024-08-30Clean up UserDataManagerBond_009
* enable nullable * remove unused methods * fix warnings and docs
2023-11-15Updated the summary and the Dto name.ArabCoders
2023-11-13Refactored the code to not use reflection.ArabCoders
2023-11-13Refactored api call logic handling.ArabCoders
2022-12-05Replace != null with is not nullBond_009
2022-10-06Use ArgumentNullException.ThrowIfNull helper methodBond_009
Did a simple search/replace on the whole repo (except the RSSDP project) This reduces LOC and should improve performance (methods containing a throw statement don't get inlined) ``` if \((\w+) == null\) \s+\{ \s+throw new ArgumentNullException\((.*)\); \s+\} ``` ``` ArgumentNullException.ThrowIfNull($1); ```
2021-12-27More cleanupBond_009
2021-10-03Fix warnings in LibraryPatrick Barron
2021-09-03Fix some warningsBond_009
2021-05-24Merge pull request #5997 from JKI12/masterClaus Vium
Fixes for Book Progress
2021-05-20Enable nullable reference types for Emby.Server.ImplementationsBond_009
2021-05-07Changed condition for readbilityJake King
- Refactored check if item is not audio book or book to be more readable
2021-05-06Fixes for Book ProgressJake King
- Ignore Books when checking for minium progress
2021-04-21Update var namesartiume
2021-04-20Fix Audiobook Resumeartiume
https://github.com/jellyfin/jellyfin/issues/5703
2021-04-17Remove unused using directivesBaronGreenback
2020-12-30Update Emby.Server.Implementations/Library/UserDataManager.csartiume
Co-authored-by: Bond-009 <bond.009@outlook.com>
2020-12-30Update Emby.Server.Implementations/Library/UserDataManager.csartiume
Co-authored-by: Bond-009 <bond.009@outlook.com>
2020-12-30Update Emby.Server.Implementations/Library/UserDataManager.csartiume
Co-authored-by: Bond-009 <bond.009@outlook.com>