From 8e89d1314264d54e4ef38900d3e13a79ad8020c5 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 7 Nov 2013 15:41:34 +0000 Subject: [PATCH 1/4] Fixes: U4-2006 Domain.GetDomain(string DomainName) is case-sensitive --- src/umbraco.cms/businesslogic/web/Domain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/umbraco.cms/businesslogic/web/Domain.cs b/src/umbraco.cms/businesslogic/web/Domain.cs index f5bcb46090..62ec9f3128 100644 --- a/src/umbraco.cms/businesslogic/web/Domain.cs +++ b/src/umbraco.cms/businesslogic/web/Domain.cs @@ -177,7 +177,7 @@ namespace umbraco.cms.businesslogic.web public static Domain GetDomain(string DomainName) { - return GetDomains().FirstOrDefault(d => d.Name == DomainName); + return GetDomains().FirstOrDefault(d => d.Name.InvariantEquals(DomainName)); } public static int GetRootFromDomain(string DomainName) From 62a7e0acd01cdd9c28e503d1800cad80e7ab3d48 Mon Sep 17 00:00:00 2001 From: "adang@thecogworks.co.uk" Date: Thu, 7 Nov 2013 15:44:55 +0000 Subject: [PATCH 2/4] Replaced HttpContext.Current.Cache with HttpRuntime.Cache --- .../umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs index 30dbe63c58..5fbb56a5a9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Web; using System.Xml.XPath; -using umbraco; using umbraco.NodeFactory; using Umbraco.Core; @@ -37,17 +36,17 @@ namespace umbraco XPathExpression xPathExpression; // Check to see if XPathExpression is in the cache - if (HttpContext.Current.Cache[xpath] == null) - { + if (HttpRuntime.Cache[xpath] == null) + { // Build Compiled XPath expression xPathExpression = xPathNavigator.Compile(xpath); // Store in Cache - HttpContext.Current.Cache[xpath] = xPathExpression; + HttpRuntime.Cache[xpath] = xPathExpression; } else // Get from Cache { - xPathExpression = (XPathExpression)HttpContext.Current.Cache[xpath]; + xPathExpression = (XPathExpression)HttpRuntime.Cache[xpath]; } // [LK] Interested in exploring options to call custom extension methods in XPath expressions. From 807df434f63ec3341fe909592bd2c47c4cff98e4 Mon Sep 17 00:00:00 2001 From: yawka Date: Thu, 7 Nov 2013 18:39:02 +0200 Subject: [PATCH 3/4] Add validation for regular expression property --- src/Umbraco.Core/Models/PropertyType.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Models/PropertyType.cs b/src/Umbraco.Core/Models/PropertyType.cs index 3b4915862a..cfeb9e832d 100644 --- a/src/Umbraco.Core/Models/PropertyType.cs +++ b/src/Umbraco.Core/Models/PropertyType.cs @@ -361,8 +361,16 @@ namespace Umbraco.Core.Models //Check against Regular Expression for Legacy DataTypes - Validation exists and value is not null: if(string.IsNullOrEmpty(ValidationRegExp) == false && (value != null && string.IsNullOrEmpty(value.ToString()) == false)) { - var regexPattern = new Regex(ValidationRegExp); - return regexPattern.IsMatch(value.ToString()); + try + { + var regexPattern = new Regex(ValidationRegExp); + return regexPattern.IsMatch(value.ToString()); + } + catch + { + throw new Exception(string .Format("Invalid validation expression on property {0}",this.Alias)); + } + } //TODO Add PropertyEditor validation when its relevant to introduce From e0a10080b1d69eb1e701d187e6a3f571facc2731 Mon Sep 17 00:00:00 2001 From: yawka Date: Thu, 7 Nov 2013 18:39:27 +0200 Subject: [PATCH 4/4] Add UI validation for regular expression property --- .../GenericProperties/GenericProperty.ascx | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/controls/GenericProperties/GenericProperty.ascx b/src/Umbraco.Web.UI/umbraco/controls/GenericProperties/GenericProperty.ascx index 4cdad45578..bd20a7d269 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/GenericProperties/GenericProperty.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/GenericProperties/GenericProperty.ascx @@ -25,33 +25,34 @@ Edit "" - - + + - + - + - + - + - +
+
Search for a regular expression
- +
@@ -69,4 +70,13 @@ duplicatePropertyNameAsSafeAlias('<%=tbName.ClientID%>', '<%=tbAlias.ClientID%>'); } }); + function ValidateValidation(sender, args) { + try { + var patt = new RegExp(args.Value); + args.IsValid = true; + + } catch (e) { + args.IsValid = false; + } + } \ No newline at end of file