From 6a18aa79e38dca334aadf99f1d4e4ba799bea870 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 7 Nov 2024 14:13:25 +0100 Subject: [PATCH] Fix wrong urls returned from Url() extension and do not show unavailable paths on info tab (#17445) * Fixed issue with urls shown to info tap, even if the url was not available because the document assigned a domain was not published in the culture * Fix issue where left to right and right to left ordering of urlsegments was not handled when using the legacy urls --- src/Umbraco.Core/Services/DocumentUrlService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Services/DocumentUrlService.cs b/src/Umbraco.Core/Services/DocumentUrlService.cs index 5148720a56..9f01fa63e9 100644 --- a/src/Umbraco.Core/Services/DocumentUrlService.cs +++ b/src/Umbraco.Core/Services/DocumentUrlService.cs @@ -488,6 +488,12 @@ public class DocumentUrlService : IDocumentUrlService } } + if (_globalSettings.ForceCombineUrlPathLeftToRight + || CultureInfo.GetCultureInfo(cultureOrDefault).TextInfo.IsRightToLeft is false) + { + urlSegments.Reverse(); + } + if (foundDomain is not null) { //we found a domain, and not to construct the route in the funny legacy way @@ -548,8 +554,15 @@ public class DocumentUrlService : IDocumentUrlService Dictionary domainDictionary = await domainDictionaryTask; if (domainDictionary.TryGetValue(culture, out Domain? domain)) { - foundDomain = domain; - break; + Attempt domainKeyAttempt = _idKeyMap.GetKeyForId(domain.ContentId, UmbracoObjectTypes.Document); + if (domainKeyAttempt.Success) + { + if (_publishStatusQueryService.IsDocumentPublished(domainKeyAttempt.Result, culture)) + { + foundDomain = domain; + break; + } + } } }