On retrieving other URLs, don't attempt to walk up the navigation structure to find parents when content is trashed. (#18355)

This commit is contained in:
Andy Butland
2025-02-18 13:31:40 +01:00
committed by GitHub
parent 04eb94d958
commit 96bbed5abf
2 changed files with 7 additions and 3 deletions

View File

@@ -89,8 +89,6 @@ public class NewDefaultUrlProvider : IUrlProvider
yield break;
}
// look for domains, walking up the tree
IPublishedContent? n = node;
IEnumerable<DomainAndUri>? domainUris =

View File

@@ -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))