diff --git a/src/Umbraco.Core/Constants-CharArrays.cs b/src/Umbraco.Core/Constants-CharArrays.cs
index 0d1722f7eb..e1318d9ae9 100644
--- a/src/Umbraco.Core/Constants-CharArrays.cs
+++ b/src/Umbraco.Core/Constants-CharArrays.cs
@@ -1,4 +1,4 @@
-namespace Umbraco.Cms.Core
+namespace Umbraco.Cms.Core
{
public static partial class Constants
{
@@ -78,6 +78,12 @@
///
public static readonly char[] TildeForwardSlash = new char[] { '~', '/' };
+
+ ///
+ /// Char array containing ~ / \
+ ///
+ public static readonly char[] TildeForwardSlashBackSlash = new char[] { '~', '/', "\\" };
+
///
/// Char array containing only ?
///
diff --git a/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs
index 8a48625cfe..b94ad6d496 100644
--- a/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs
+++ b/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs
@@ -86,7 +86,7 @@ namespace Umbraco.Cms.Core.Routing
// and then the comparisons in IsMatch can be way faster - and allocate way less strings
const string propertyAlias = Constants.Conventions.Content.UrlAlias;
- var test1 = alias.TrimStart('/') + ",";
+ var test1 = alias.TrimStart(Constants.CharArrays.ForwardSlash) + ",";
var test2 = ",/" + test1; // test2 is ",/alias,"
test1 = "," + test1; // test1 is ",alias,"
diff --git a/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs b/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs
index 084b9b47e3..5d298b811a 100644
--- a/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs
+++ b/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs
@@ -31,7 +31,7 @@ namespace Umbraco.Cms.Core.Routing
public UmbracoRequestPaths(IOptions globalSettings, IHostingEnvironment hostingEnvironment)
{
var applicationPath = hostingEnvironment.ApplicationVirtualPath;
- _appPath = applicationPath.TrimStart('/');
+ _appPath = applicationPath.TrimStart(Constants.CharArrays.ForwardSlash);
_backOfficePath = globalSettings.Value.GetBackOfficePath(hostingEnvironment)
.EnsureStartsWith('/').TrimStart(_appPath.EnsureStartsWith('/')).EnsureStartsWith('/');
@@ -71,7 +71,7 @@ namespace Umbraco.Cms.Core.Routing
///
public bool IsBackOfficeRequest(string absPath)
{
- var fullUrlPath = absPath.TrimStart('/');
+ var fullUrlPath = absPath.TrimStart(Constants.CharArrays.ForwardSlash);
var urlPath = fullUrlPath.TrimStart(_appPath).EnsureStartsWith('/');
// check if this is in the umbraco back office
@@ -108,7 +108,7 @@ namespace Umbraco.Cms.Core.Routing
// Umbraco/MYPLUGINAREA/MYCONTROLLERNAME/{action}/{id}
// so if the path contains at a minimum 3 parts: Umbraco + MYPLUGINAREA + MYCONTROLLERNAME then we will have to assume it is a
// plugin controller for the front-end.
- if (urlPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Length >= 3)
+ if (urlPath.Split(Constants.CharArrays.ForwardSlash, StringSplitOptions.RemoveEmptyEntries).Length >= 3)
{
return false;
}
diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
index 0b9801f871..bb87ea62bf 100644
--- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
@@ -141,7 +141,7 @@ namespace Umbraco.Cms.Web.Common.AspNetCore
throw new ArgumentException("The path appears to already be fully qualified. Please remove the call to MapPath");
}
- return Path.Combine(root, newPath.TrimStart('~', '/', '\\'));
+ return Path.Combine(root, newPath.TrimStart(Core.Constants.CharArrays.TildeForwardSlashBackSlash));
}
///