V15: Add back url segments again (#17390)

* Add logic for UrlSegments back

* Revert extension method back
This commit is contained in:
Nikolaj Geisle
2024-10-29 13:20:48 +01:00
committed by GitHub
parent 9ac2234121
commit 3ecd5b470f
4 changed files with 16 additions and 10 deletions

View File

@@ -1,6 +1,5 @@
using StackExchange.Profiling.Internal;
using Umbraco.Cms.Core.Media.EmbedProviders;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Extensions;
@@ -10,11 +9,13 @@ internal class CacheNodeFactory : ICacheNodeFactory
{
private readonly IShortStringHelper _shortStringHelper;
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly IDocumentUrlService _documentUrlService;
public CacheNodeFactory(IShortStringHelper shortStringHelper, UrlSegmentProviderCollection urlSegmentProviders)
public CacheNodeFactory(IShortStringHelper shortStringHelper, UrlSegmentProviderCollection urlSegmentProviders, IDocumentUrlService documentUrlService)
{
_shortStringHelper = shortStringHelper;
_urlSegmentProviders = urlSegmentProviders;
_documentUrlService = documentUrlService;
}
public ContentCacheNode ToContentCacheNode(IContent content, bool preview)
@@ -126,6 +127,7 @@ internal class CacheNodeFactory : ICacheNodeFactory
}
var cultureData = new Dictionary<string, CultureVariation>();
string? urlSegment = null;
// sanitize - names should be ok but ... never knows
if (content.ContentType.VariesByCulture())
@@ -153,10 +155,14 @@ internal class CacheNodeFactory : ICacheNodeFactory
}
}
}
else
{
urlSegment = content.GetUrlSegment(_shortStringHelper, _urlSegmentProviders);
}
return new ContentData(
content.Name,
null,
urlSegment,
content.VersionId,
content.UpdateDate,
content.CreatorId,