aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Sorting
AgeCommit message (Collapse)Author
2 daysMerge pull request #17399 from Shadowghost/fix-extra-yearCody Robibero
Fix incorrect year on local trailers
6 daysPrefer null checks over HasValue everywhereShadowghost
6 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
2026-03-10Respect library country code for parental ratingstheguymadmax
2026-01-14Replace AlphanumericComparator with new CompareOptions.NumericOrderingBond_009
2025-09-14Revert IsPlayed optimization, pass UserItemData to IsPlayed when available ↵Cody Robibero
(#14786)
2025-06-26Fix modification checks and make sure to use UTC (#14347)Tim Eisele
2025-05-09Cleanup external item data cleanup (#14072)Tim Eisele
2025-03-30Rework parental ratings (#12615)Tim Eisele
2025-03-25Fixed namespacesJPVenson
2024-03-27Replace LINQ with more direct access methodSaid Aroua
Also rework documentation
2023-11-09Convert ItemSortBy to enum (#9765)Cody Robibero
* Convert ItemSortBy to enum * Rename Unknown to Default
2023-02-15Enable nullable for more filesBond_009
2022-12-05Replace != null with is not nullBond_009
2022-12-05Replace == null with is 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); ```
2022-09-28Remove redundant using directivesHannes Braun
2022-04-07Merge pull request #7548 from 1337joe/comparer-null-fixCody Robibero
(cherry picked from commit 72aca1519132315a69d9dad53e4840f461e58285) Signed-off-by: crobibero <cody@robibe.ro>
2022-02-17Implement Comparers for (Parent)IndexNumberMaxr1998
Can be used in item queries to sort by ParentIndexNumber and IndexNumber (used for disc and track numbers for example).
2021-12-27More cleanupBond_009
2021-11-15Fix some warningsBond_009
2021-10-03Fix warnings in SortingPatrick Barron
2021-09-21Merge pull request #6553 from ankenyr/masterClaus Vium
2021-09-13Update Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.csRob
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
2021-09-13Update Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.csRob
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
2021-09-13Update Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.csRob
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
2021-09-12Fixing #6269 by comparing PremiereDate when episode comparison would ↵ankenyr
otherwise be equal.
2021-08-28Remove more and more warningsCody Robibero
2021-06-19Move non-jellyfin extensions to separate projectBond_009
2021-05-20Enable nullable reference types for Emby.Server.ImplementationsBond_009
2021-02-28Include specials in the calculation for the "Next Up" episode. Fixes #1479Moshe Schmidt
2020-07-24Fix warningsBond_009
2020-06-20brace multiline if statementstelans
2020-06-16Merge pull request #3343 from telans/comment-stopsBond-009
Add full stop at end of comments (SA1629)
2020-06-16fix SA1513/SA1516telans
2020-06-16Add full stop at end of comments (SA1629)telans
2020-06-15fix SA1005telans
2020-06-04Merge branch 'master' into userdb-efcorePatrick Barron
# Conflicts: # Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs # Emby.Server.Implementations/Library/UserManager.cs # Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs # Emby.Server.Implementations/Sorting/IsPlayedComparer.cs # Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs # Emby.Server.Implementations/TV/TVSeriesManager.cs # Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs
2020-05-29Enable TreatWarningsAsErrors for Jellyfin.Server.Implementations in Release modeBond_009
2020-05-20Remove redundant qualifiersPatrick Barron
2020-05-12Initial migration codePatrick Barron
2020-02-27Simplify AlphanumericComparer, reduce code duplicationVasily
2019-11-22Fix some warningsBond-009
2019-08-29More warning fixesBond_009
2019-03-13More warning fixesBond-009
2019-02-15Make all class implementing dynamically loaded interfaces publicClaus Vium
2019-01-31Remove support for games as a media typeClaus Vium
2019-01-13ReSharper conform to 'var' settingsErwin de Haan
2019-01-13Find+Sed BOM removal *.cs: BDInfo-Emby.XmlTvErwin de Haan
2019-01-13EditorConfig reformat: Emby.IsoMounting, Emby.Server.ImplementationsErwin de Haan