Updating disallowed chars in routes and titles

http://orchard.codeplex.com/workitem/16367

--HG--
branch : dev
This commit is contained in:
Sebastien Ros 2010-11-15 17:31:31 -08:00
parent 4f1f055377
commit 7bafff2dfb
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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) {