#19177: Adding "|" in the list of forbidden url characters

Work Item: 19177

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-10-22 16:47:29 -07:00
parent 293288928c
commit 4bb9b558d2
3 changed files with 4 additions and 4 deletions

View File

@@ -98,7 +98,7 @@ namespace Orchard.Autoroute.Drivers {
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

View File

@@ -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\""\<\>\\\|]+$") && !(slug.StartsWith(".") || slug.EndsWith("."));
}
public bool ProcessPath(AutoroutePart part) {

View File

@@ -7,7 +7,7 @@ namespace Orchard.Autoroute.Services {
public class DefaultSlugService : ISlugService {
private readonly ISlugEventHandler _slugEventHandler;
public DefaultSlugService(
ISlugEventHandler slugEventHander
) {
@@ -26,7 +26,7 @@ namespace Orchard.Autoroute.Services {
if (!slugContext.Adjusted) {
var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\]+");
var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\\|]+");
slugContext.Slug = disallowed.Replace(slugContext.Title, "-").Trim('-','.');