Fixes #6113 : Anchor custom link on homepage produces bad href

This commit is contained in:
Thierry Fleury
2015-12-01 17:23:53 +01:00
parent 6e3c8cbb9e
commit 19faeecc9a

View File

@@ -93,16 +93,15 @@ namespace Orchard.Core.Navigation.Services {
var schemes = new[] { "http", "https", "tel", "mailto" };
if (!string.IsNullOrEmpty(url) && _urlHelper.RequestContext.HttpContext != null &&
!(url.StartsWith("/") || schemes.Any(scheme => url.StartsWith(scheme + ":")))) {
if (url.StartsWith("~/")) {
if (!String.IsNullOrEmpty(_shellSettings.RequestUrlPrefix)) {
url = _shellSettings.RequestUrlPrefix + "/" + url.Substring(2);
}
else {
url = url.Substring(2);
}
}
if (!url.StartsWith("#")) {
if (url.StartsWith("~/")) {
if (!String.IsNullOrEmpty(_shellSettings.RequestUrlPrefix)) {
url = _shellSettings.RequestUrlPrefix + "/" + url.Substring(2);
}
else {
url = url.Substring(2);
}
}
var appPath = _urlHelper.RequestContext.HttpContext.Request.ApplicationPath;
if (appPath == "/")
appPath = "";