Don't pass in Root to ToAbsolute there's no need

This commit is contained in:
Shannon
2020-04-03 09:17:40 +11:00
parent fa2e9c3715
commit 1224c97f07
4 changed files with 8 additions and 13 deletions

View File

@@ -86,14 +86,13 @@ namespace Umbraco.Web.Common.AspNetCore
return Path.Combine(_webHostEnvironment.WebRootPath, newPath);
}
// TODO: Need to take into account 'root' here, maybe not, Root probably shouldn't be a param, see notes in IOHelper that calls this, we already know ApplicationVirtualPath
public string ToAbsolute(string virtualPath, string root)
public string ToAbsolute(string virtualPath)
{
if (!virtualPath.StartsWith("~/") && !virtualPath.StartsWith("/"))
throw new InvalidOperationException($"{nameof(virtualPath)} must start with ~/ or /");
if (!root.StartsWith("/"))
throw new InvalidOperationException($"{nameof(virtualPath)} must start with /");
var root = ApplicationVirtualPath.EnsureStartsWith('/');
// will occur if it starts with "/"
if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
return virtualPath;