mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19177: Adding "|" in the list of forbidden url characters
Work Item: 19177 --HG-- branch : 1.x
This commit is contained in:
@@ -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
|
||||
|
@@ -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) {
|
||||
|
@@ -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('-','.');
|
||||
|
||||
|
Reference in New Issue
Block a user