Skip to content

Commit 5ae984a

Browse files
authored
Empty filter and sort values should not be considered when executing queries (#14295)
1 parent 3cadd35 commit 5ae984a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Umbraco.Cms.Api.Delivery/Services/ApiContentQueryService.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Umbraco.Cms.Core.DeliveryApi;
44
using Umbraco.Cms.Core.Models.PublishedContent;
55
using Umbraco.Cms.Core.Services.OperationStatus;
6+
using Umbraco.Extensions;
67
using Umbraco.New.Cms.Core.Models;
78

89
namespace Umbraco.Cms.Api.Delivery.Services;
@@ -45,7 +46,7 @@ public Attempt<PagedModel<Guid>, ApiContentQueryOperationStatus> ExecuteQuery(st
4546
}
4647

4748
var filterOptions = new List<FilterOption>();
48-
foreach (var filter in filters)
49+
foreach (var filter in filters.Where(filter => filter.IsNullOrWhiteSpace() is false))
4950
{
5051
FilterOption? filterOption = GetFilterOption(filter);
5152
if (filterOption is null)
@@ -58,7 +59,7 @@ public Attempt<PagedModel<Guid>, ApiContentQueryOperationStatus> ExecuteQuery(st
5859
}
5960

6061
var sortOptions = new List<SortOption>();
61-
foreach (var sort in sorts)
62+
foreach (var sort in sorts.Where(sort => sort.IsNullOrWhiteSpace() is false))
6263
{
6364
SortOption? sortOption = GetSortOption(sort);
6465
if (sortOption is null)

0 commit comments

Comments
 (0)