mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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("."))
|
if (path.StartsWith(".") || path.EndsWith("."))
|
||||||
updater.AddModelError("CurrentUrl", T("The \".\" can't be used at either end of the permalink."));
|
updater.AddModelError("CurrentUrl", T("The \".\" can't be used at either end of the permalink."));
|
||||||
else
|
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
|
// 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) {
|
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) {
|
public bool ProcessPath(AutoroutePart part) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Orchard.Autoroute.Services {
|
|||||||
public class DefaultSlugService : ISlugService {
|
public class DefaultSlugService : ISlugService {
|
||||||
|
|
||||||
private readonly ISlugEventHandler _slugEventHandler;
|
private readonly ISlugEventHandler _slugEventHandler;
|
||||||
|
|
||||||
public DefaultSlugService(
|
public DefaultSlugService(
|
||||||
ISlugEventHandler slugEventHander
|
ISlugEventHandler slugEventHander
|
||||||
) {
|
) {
|
||||||
@@ -26,7 +26,7 @@ namespace Orchard.Autoroute.Services {
|
|||||||
|
|
||||||
if (!slugContext.Adjusted) {
|
if (!slugContext.Adjusted) {
|
||||||
|
|
||||||
var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\]+");
|
var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\\|]+");
|
||||||
|
|
||||||
slugContext.Slug = disallowed.Replace(slugContext.Title, "-").Trim('-','.');
|
slugContext.Slug = disallowed.Replace(slugContext.Title, "-").Trim('-','.');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user