From 90820483d5c009cc7075c7f1a641dae783b47f86 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:36:00 +0100 Subject: [PATCH] Try to parse string as int and return id.ToString(CultureInfo.InvariantCulture) (#15848) --- src/Umbraco.Examine.Lucene/DeliveryApiContentIndex.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Examine.Lucene/DeliveryApiContentIndex.cs b/src/Umbraco.Examine.Lucene/DeliveryApiContentIndex.cs index a3508a3fed..c572fc85f7 100644 --- a/src/Umbraco.Examine.Lucene/DeliveryApiContentIndex.cs +++ b/src/Umbraco.Examine.Lucene/DeliveryApiContentIndex.cs @@ -1,9 +1,9 @@ +using System.Globalization; using Examine; using Examine.Lucene; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Umbraco.Cms.Core; using Umbraco.Cms.Core.DeliveryApi; using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Hosting; @@ -125,8 +125,14 @@ public class DeliveryApiContentIndex : UmbracoExamineIndex private (string? ContentId, string? Culture) ParseItemId(string id) { + if (int.TryParse(id, out _)) + { + return (id, null); + } + DeliveryApiIndexCompositeIdModel compositeIdModel = _deliveryApiCompositeIdHandler.Decompose(id); - return (compositeIdModel.Id.ToString() ?? id, compositeIdModel.Culture); + + return (compositeIdModel.Id?.ToString(CultureInfo.InvariantCulture), compositeIdModel.Culture); } protected override void OnTransformingIndexValues(IndexingItemEventArgs e)