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
This commit is contained in:
Bjarke Berg
2024-11-07 14:13:25 +01:00
committed by GitHub
parent d101829a90
commit 6a18aa79e3

View File

@@ -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<string, Domain> domainDictionary = await domainDictionaryTask;
if (domainDictionary.TryGetValue(culture, out Domain? domain))
{
foundDomain = domain;
break;
Attempt<Guid> domainKeyAttempt = _idKeyMap.GetKeyForId(domain.ContentId, UmbracoObjectTypes.Document);
if (domainKeyAttempt.Success)
{
if (_publishStatusQueryService.IsDocumentPublished(domainKeyAttempt.Result, culture))
{
foundDomain = domain;
break;
}
}
}
}