From c37ba0dc8a06c856594c890fb3d9519211f2f22a Mon Sep 17 00:00:00 2001 From: Dennis Spijkerboer Date: Thu, 29 Oct 2015 12:56:07 +0100 Subject: [PATCH] Checked if the trimmed value starts and ends with brackets. If so, use the trimmed value. --- src/Umbraco.Web/umbraco.presentation/helper.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/helper.cs b/src/Umbraco.Web/umbraco.presentation/helper.cs index f9292702e0..0d133fee66 100644 --- a/src/Umbraco.Web/umbraco.presentation/helper.cs +++ b/src/Umbraco.Web/umbraco.presentation/helper.cs @@ -112,14 +112,17 @@ namespace umbraco foreach (var attributeValueItem in attributeValueSplit) { attributeValue = attributeValueItem; + var trimmedValue = attributeValue.Trim(); // Check for special variables (always in square-brackets like [name]) - if (attributeValueItem.StartsWith("[") && - attributeValueItem.EndsWith("]")) + if (trimmedValue.StartsWith("[") && + trimmedValue.EndsWith("]")) { + attributeValue = trimmedValue; + // find key name - var keyName = attributeValueItem.Substring(2, attributeValueItem.Length - 3); - var keyType = attributeValueItem.Substring(1, 1); + var keyName = attributeValue.Substring(2, attributeValue.Length - 3); + var keyType = attributeValue.Substring(1, 1); switch (keyType) {