From 7bafff2dfba74bc813fdf90d9b61ec7df90b4a00 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 15 Nov 2010 17:31:31 -0800 Subject: [PATCH] Updating disallowed chars in routes and titles http://orchard.codeplex.com/workitem/16367 --HG-- branch : dev --- src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs | 2 +- src/Orchard.Web/Core/Routable/Services/RoutableService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs index cb72a284c..976894f8a 100644 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs +++ b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs @@ -82,7 +82,7 @@ namespace Orchard.Core.Routable.Drivers { if ( slug.StartsWith(".") || slug.EndsWith(".") ) updater.AddModelError("Routable.Slug", T("The \".\" can't be used around routes.")); else - updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\". No spaces are allowed (please use dashes or underscores instead).")); + updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\". No spaces are allowed (please use dashes or underscores instead).")); } if (part.ContentItem.Id != 0 && model.PromoteToHomePage && _routableHomePageProvider != null) diff --git a/src/Orchard.Web/Core/Routable/Services/RoutableService.cs b/src/Orchard.Web/Core/Routable/Services/RoutableService.cs index aa6f776d9..2ddea2f21 100644 --- a/src/Orchard.Web/Core/Routable/Services/RoutableService.cs +++ b/src/Orchard.Web/Core/Routable/Services/RoutableService.cs @@ -32,7 +32,7 @@ namespace Orchard.Core.Routable.Services { return; var slug = model.Title; - var dissallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s]+"); + var dissallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>]+"); slug = dissallowed.Replace(slug, "-"); slug = slug.Trim('-'); @@ -79,7 +79,7 @@ namespace Orchard.Core.Routable.Services { } public bool IsSlugValid(string slug) { - return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s]+$") && !(slug.StartsWith(".") || slug.EndsWith(".")); + return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s\""\<\>]+$") && !(slug.StartsWith(".") || slug.EndsWith(".")); } public bool ProcessSlug(IRoutableAspect part) {