From f6b293203aac0dd57c93ca9e77b8441a2c1918fd Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 24 Jan 2021 17:55:25 +0100 Subject: [PATCH] Restore weird behaviour --- Jellyfin.Api/Helpers/RequestHelpers.cs | 6 ++++-- tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Jellyfin.Api/Helpers/RequestHelpers.cs b/Jellyfin.Api/Helpers/RequestHelpers.cs index 59cb8ea2c1..cd1e31e804 100644 --- a/Jellyfin.Api/Helpers/RequestHelpers.cs +++ b/Jellyfin.Api/Helpers/RequestHelpers.cs @@ -40,10 +40,12 @@ namespace Jellyfin.Api.Helpers result[i] = (sortBy[i], requestedSortOrder[i]); } - // Add remaining elements with the default SortOrder + // Add remaining elements with the first specified SortOrder + // or the default one if no SortOrders are specified + var order = requestedSortOrder.Count > 0 ? requestedSortOrder[0] : SortOrder.Ascending; for (; i < sortBy.Count; i++) { - result[i] = (sortBy[i], SortOrder.Ascending); + result[i] = (sortBy[i], order); } return result; diff --git a/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs b/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs index 944472c689..606041c7f4 100644 --- a/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs +++ b/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs @@ -51,7 +51,7 @@ namespace Jellyfin.Api.Tests.Helpers new (string, SortOrder)[] { ("SortName", SortOrder.Descending), - ("ProductionYear", SortOrder.Ascending), + ("ProductionYear", SortOrder.Descending), } }; }