From 671ebf91d55a82b51f2ad93f67c3714eb42bfe62 Mon Sep 17 00:00:00 2001 From: Markus Johansson Date: Mon, 15 Mar 2021 10:32:32 +0100 Subject: [PATCH] #9964 Removed unneeded check for HttpContext --- src/Umbraco.Core/IO/IOHelper.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 8661f73fb1d4..69ce50de9cc1 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -81,6 +81,7 @@ public static Attempt TryResolveUrl(string virtualPath) public static string MapPath(string path, bool useHttpContext) { if (path == null) throw new ArgumentNullException("path"); + useHttpContext = useHttpContext && IsHosted; // Check if the path is already mapped @@ -89,10 +90,8 @@ public static string MapPath(string path, bool useHttpContext) { return path; } - // Check that we even have an HttpContext! otherwise things will fail anyways - // http://umbraco.codeplex.com/workitem/30946 - if (useHttpContext && HttpContext.Current != null) + if (useHttpContext) { //string retval; if (String.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(SystemDirectories.Root)))