From 04c9771978a5d4c0d813e43a92852a2bfb51c3bb Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 19 Feb 2013 13:58:16 -0100 Subject: [PATCH] U4-1611 - bugfix --- .../ContentStores/PublishContentStoreTests.cs | 3 +++ src/Umbraco.Web/DefaultPublishedContentStore.cs | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs b/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs index 26594a57da..a8a335dd5a 100644 --- a/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs +++ b/src/Umbraco.Tests/ContentStores/PublishContentStoreTests.cs @@ -54,6 +54,8 @@ namespace Umbraco.Tests.ContentStores + + "; @@ -155,6 +157,7 @@ namespace Umbraco.Tests.ContentStores [TestCase("/home/sub1", 1173)] [TestCase("/Home/sub1", 1173)] [TestCase("/home/Sub1", 1173)] //test different cases + [TestCase("/home/Sub'Apostrophe", 1177)] public void Get_Node_By_Route(string route, int nodeId) { var result = _publishedContentStore.GetDocumentByRoute(_umbracoContext, route, false); diff --git a/src/Umbraco.Web/DefaultPublishedContentStore.cs b/src/Umbraco.Web/DefaultPublishedContentStore.cs index 215461243c..5a86d3c6c6 100644 --- a/src/Umbraco.Web/DefaultPublishedContentStore.cs +++ b/src/Umbraco.Web/DefaultPublishedContentStore.cs @@ -29,7 +29,8 @@ namespace Umbraco.Web public string DescendantDocumentById { get; private set; } public string DescendantDocumentByAlias { get; private set; } public string ChildDocumentByUrlName { get; private set; } - public string RootDocumentWithLowestSortOrder { get; private set; } + public string ChildDocumentByUrlNameVar { get; private set; } + public string RootDocumentWithLowestSortOrder { get; private set; } public XPathStringsDefinition(int version) { @@ -46,6 +47,7 @@ namespace Umbraco.Web + " or contains(concat(',',translate(data [@alias='umbracoUrlAlias'], ' ', ''),','),',/{0},')" + ")]"; ChildDocumentByUrlName = "/node [@urlName='{0}']"; + ChildDocumentByUrlNameVar = "/node [@urlName=${0}]"; RootDocumentWithLowestSortOrder = "/root/node [not(@sortOrder > ../node/@sortOrder)][1]"; break; @@ -58,6 +60,7 @@ namespace Umbraco.Web + " or contains(concat(',',translate(umbracoUrlAlias, ' ', ''),','),',/{0},')" + ")]"; ChildDocumentByUrlName = "/* [@isDoc and @urlName='{0}']"; + ChildDocumentByUrlNameVar = "/* [@isDoc and @urlName=${0}]"; RootDocumentWithLowestSortOrder = "/root/* [@isDoc and not(@sortOrder > ../* [@isDoc]/@sortOrder)][1]"; break; @@ -248,12 +251,18 @@ namespace Umbraco.Web varsList = varsList ?? new List(); var varName = string.Format("var{0}", partsIndex); varsList.Add(new XPathVariable(varName, part)); - part = "$" + varName; + xpathBuilder.AppendFormat(XPathStrings.ChildDocumentByUrlNameVar, varName); + } + else + { + xpathBuilder.AppendFormat(XPathStrings.ChildDocumentByUrlName, part); + } - xpathBuilder.AppendFormat(XPathStrings.ChildDocumentByUrlName, part); } xpath = xpathBuilder.ToString(); + if (varsList != null) + vars = varsList.ToArray(); } return xpath;