mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19362: Fixing another regex and removing starts with and ends with dots.
Work Item: 19362 --HG-- branch : 1.x
This commit is contained in:
@@ -94,11 +94,7 @@ namespace Orchard.Autoroute.Drivers {
|
||||
}
|
||||
|
||||
if (!_autorouteService.IsPathValid(part.DisplayAlias)) {
|
||||
var path = (part.DisplayAlias ?? String.Empty);
|
||||
if (path.StartsWith(".") || path.EndsWith("."))
|
||||
updater.AddModelError("CurrentUrl", T("The \".\" can't be used at either end of the permalink."));
|
||||
else
|
||||
updater.AddModelError("CurrentUrl", T("Please do not use any of the following characters in your permalink: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\", \"\\\", \"|\", \"%\". No spaces are allowed (please use dashes or underscores instead)."));
|
||||
updater.AddModelError("CurrentUrl", T("Please do not use any of the following characters in your permalink: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\", \"\\\", \"|\", \"%\", \".\". No spaces are allowed (please use dashes or underscores instead)."));
|
||||
}
|
||||
|
||||
// if CurrentUrl is set, the handler won't try to create an alias for it
|
||||
|
@@ -166,7 +166,7 @@ namespace Orchard.Autoroute.Services {
|
||||
}
|
||||
|
||||
public bool IsPathValid(string slug) {
|
||||
return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s\""\<\>\\\|%]+$") && !(slug.StartsWith(".") || slug.EndsWith("."));
|
||||
return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,.;=\s\""\<\>\\\|%]+$");
|
||||
}
|
||||
|
||||
public bool ProcessPath(AutoroutePart part) {
|
||||
|
Reference in New Issue
Block a user