From 96bbed5abf94511b5dfc0ffb05c7b3982904e33b Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 18 Feb 2025 13:31:40 +0100 Subject: [PATCH] On retrieving other URLs, don't attempt to walk up the navigation structure to find parents when content is trashed. (#18355) --- src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs | 2 -- src/Umbraco.Core/Routing/PublishedUrlInfoProvider.cs | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs b/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs index bbc0f4011b..7f66f21933 100644 --- a/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs +++ b/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs @@ -89,8 +89,6 @@ public class NewDefaultUrlProvider : IUrlProvider yield break; } - - // look for domains, walking up the tree IPublishedContent? n = node; IEnumerable? domainUris = diff --git a/src/Umbraco.Core/Routing/PublishedUrlInfoProvider.cs b/src/Umbraco.Core/Routing/PublishedUrlInfoProvider.cs index d4059bcab8..c861d9ba01 100644 --- a/src/Umbraco.Core/Routing/PublishedUrlInfoProvider.cs +++ b/src/Umbraco.Core/Routing/PublishedUrlInfoProvider.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.Services; @@ -68,6 +68,12 @@ public class PublishedUrlInfoProvider : IPublishedUrlInfoProvider urlInfos.Add(UrlInfo.Url(url, culture)); } + // If the content is trashed, we can't get the other URLs, as we have no parent structure to navigate through. + if (content.Trashed) + { + return urlInfos; + } + // Then get "other" urls - I.E. Not what you'd get with GetUrl(), this includes all the urls registered using domains. // for these 'other' URLs, we don't check whether they are routable, collide, anything - we just report them. foreach (UrlInfo otherUrl in _publishedUrlProvider.GetOtherUrls(content.Id).OrderBy(x => x.Text).ThenBy(x => x.Culture))