mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 10:23:39 +08:00
Updating disallowed chars in routes and titles
http://orchard.codeplex.com/workitem/16367 --HG-- branch : dev
This commit is contained in:
parent
4f1f055377
commit
7bafff2dfb
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user