Skip to content

Commit 44c3080

Browse files
Handle invariant domains (#17937)
1 parent 3873b5b commit 44c3080

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Umbraco.Core/Services/DocumentUrlService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,12 @@ public string GetLegacyRouteFormat(Guid documentKey, string? culture, bool isDra
469469
}
470470

471471
IEnumerable<Domain> domains = _domainCacheService.GetAssigned(idAttempt.Result, false);
472-
return domains.FirstOrDefault(x=>x.Culture == cultureOrDefault);
472+
473+
// If no culture is specified, we assume invariant and return the first domain.
474+
// This is also only used to later to specify the node id in the route, so it does not matter what culture it is.
475+
return string.IsNullOrEmpty(culture)
476+
? domains.FirstOrDefault()
477+
: domains.FirstOrDefault(x => x.Culture?.Equals(culture, StringComparison.InvariantCultureIgnoreCase) ?? false);
473478
});
474479

475480
var urlSegments = new List<string>();

0 commit comments

Comments
 (0)