Various fixes, and U4-11287

This commit is contained in:
Stephan
2018-05-07 18:22:23 +02:00
parent 5247a9d143
commit 3f73452bc7
7 changed files with 69 additions and 37 deletions

View File

@@ -147,7 +147,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
var hasDomains = _domainHelper.NodeHasDomains(n.Id);
while (hasDomains == false && n != null) // n is null at root
{
var urlSegment = n.GetCulture(culture).UrlSegment;
var varies = n.ContentType.Variations.Has(ContentVariation.CultureNeutral);
var urlSegment = varies ? n.GetCulture(culture)?.UrlSegment : n.UrlSegment;
// at that point we should have an urlSegment, unless something weird is happening
// at content level, such as n.GetCulture() returning null for some (weird) reason,
// and then what? fallback to the invariant segment... far from perfect but eh...
if (string.IsNullOrWhiteSpace(urlSegment)) urlSegment = n.UrlSegment;
pathParts.Add(urlSegment);