Merge pull request #6114 from Codinlab/fixes/6113

[Fixes #6113] Anchor custom link on homepage produces bad href
This commit is contained in:
Sébastien Ros
2016-01-07 12:10:03 -08:00

View File

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