U4-2006 - Domain.GetDomain(string DomainName) is case-sensitive

Created by Lee Kelleher 27 Mar 2013, 09:19:53 Updated by Shannon Deminick 08 Jan 2014, 06:20:24

'''MultiSitePageNotFoundHandler is case sensitive''' http://ucomponents.codeplex.com/workitem/14821

This is for uComponents 5.1.0. I have found out that when {{MultiSitePageNotFoundHandler}} searches for a domain name in the database table {{umbracoDomains}} the search is case sensitive. e.g. if in the table the domain name is "www.DomainName.co.uk" then this record is not found.

This is not normally an issue as the Umbraco front end converts hostnames to lower case before inserting, but in my case I have added these directly to the table. The obvious workaround is to lower case the domain names which I have done, but this issue issue not always easy to track down.

In uComponents we don't do any string matching/comparisons, we only make a call to {{umbraco.cms.businesslogic.web.Domain.GetRootFromDomain(string DomainName)}}.

I've checked the Umbraco core source and found that the {{GetDomain}} method does the following look-up:

return GetDomains().Find(delegate(Domain d) { return d.Name == DomainName; });

A proposed fix would be to change the check/match to a {{string.Equals}}, with "OrdinalIgnoreCase":

return GetDomains().Find(delegate(Domain d) { return string.Equals(d.Name, DomainName, StringComparison.OrdinalIgnoreCase); });

Comments

Stephan 07 Nov 2013, 15:24:26

Fine with me. Alternatively... return d.Name.InvariantEquals(DomainName) ? Should be an extension in Umbraco.Core...


Lee Kelleher 07 Nov 2013, 15:41:00

Pull request submitted: https://github.com/umbraco/Umbraco-CMS/pull/220


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Easy

Category:

Backwards Compatible: False

Fix Submitted: Pull request, Inline code

Affected versions: 6.1.0, 4.11.5, 6.0.2

Due in version: 6.2.0, 7.0.2

Sprint:

Story Points:

Cycle: