diff --git a/.hgignore b/.hgignore index 2f59efa4c7..b6d7ce3ab3 100644 --- a/.hgignore +++ b/.hgignore @@ -1,4 +1,4 @@ -syntax: regex +syntax: regexp ^src/packages/(?!repositories.config$) syntax: glob diff --git a/src/Umbraco.Web/Routing/DomainHelper.cs b/src/Umbraco.Web/Routing/DomainHelper.cs index a8ab38b4cc..8720008392 100644 --- a/src/Umbraco.Web/Routing/DomainHelper.cs +++ b/src/Umbraco.Web/Routing/DomainHelper.cs @@ -42,6 +42,11 @@ namespace Umbraco.Web.Routing } } + private static bool IsWildcardDomain(Domain d) + { + return string.IsNullOrWhiteSpace(d.Name) || d.Name.StartsWith("*"); + } + /// /// Finds the domain that best matches the current uri, into an enumeration of domains. /// @@ -56,7 +61,7 @@ namespace Umbraco.Web.Routing // we need to order so example.com/foo matches before example.com/ var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme; var domainsAndUris = domains - .Where(d => !string.IsNullOrEmpty(d.Name) && d.Name != "*") + .Where(d => !IsWildcardDomain(d)) .Select(d => new { Domain = d, UriString = UriUtility.EndPathWithSlash(UriUtility.StartWithScheme(d.Name, scheme)) }) .OrderByDescending(t => t.UriString) .Select(t => new DomainAndUri { Domain = t.Domain, Uri = new Uri(t.UriString) }); @@ -96,7 +101,7 @@ namespace Umbraco.Web.Routing { var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme; var domainsAndUris = domains - .Where(d => !string.IsNullOrEmpty(d.Name) && d.Name != "*") + .Where(d => !IsWildcardDomain(d)) .Select(d => new { Domain = d, UriString = UriUtility.TrimPathEndSlash(UriUtility.StartWithScheme(d.Name, scheme)) }) .OrderByDescending(t => t.UriString) .Select(t => new DomainAndUri { Domain = t.Domain, Uri = new Uri(t.UriString) }); @@ -117,7 +122,7 @@ namespace Umbraco.Web.Routing .Reverse() .Select(id => int.Parse(id)) .TakeWhile(id => id != current.RootNodeId) - .Any(id => domains.Any(d => d.RootNodeId == id && !string.IsNullOrEmpty(d.Name) && d.Name != "*")); + .Any(id => domains.Any(d => d.RootNodeId == id && !IsWildcardDomain(d))); } /// @@ -139,7 +144,7 @@ namespace Umbraco.Web.Routing // supporting null or whitespace for backward compatibility, // although we should not allow ppl to create them anymore - var domain = domains.Where(d => d.RootNodeId == nodeId && (string.IsNullOrWhiteSpace(d.Name) || d.Name == "*")).FirstOrDefault(); + var domain = domains.Where(d => d.RootNodeId == nodeId && IsWildcardDomain(d)).FirstOrDefault(); if (domain != null) return domain; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs index b192298b75..7c9d0f71c9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs @@ -50,7 +50,7 @@ namespace umbraco.dialogs { Domain d = new Domain(editDomain); selectedLanguage = d.Language.id; - DomainName.Text = d.Name; + DomainName.Text = d.Name.StartsWith("*") ? "*" : d.Name; ok.Text = ui.Text("general", "update", base.getUser()); } @@ -82,7 +82,8 @@ namespace umbraco.dialogs allDomains.Text = ""; foreach (Domain d in domainList) { - allDomains.Text += "
" + d.Name + "(" + d.Language.CultureAlias + ")(" + d.Language.CultureAlias + ")" + ui.Text("edit") + "