Fix RootPath was not working correctly on Linux

This commit is contained in:
nicolas.dorier 2019-03-08 23:37:33 +09:00
parent 603263549b
commit 7e67ca1413

View file

@ -217,8 +217,10 @@ namespace BTCPayServer
/// <returns></returns> /// <returns></returns>
public static string GetRelativePathOrAbsolute(this HttpRequest request, string path) public static string GetRelativePathOrAbsolute(this HttpRequest request, string path)
{ {
if (Uri.TryCreate(path, UriKind.Absolute, out var unused)) if (!Uri.TryCreate(path, UriKind.RelativeOrAbsolute, out var uri) ||
uri.IsAbsoluteUri)
return path; return path;
if (path.Length > 0 && path[0] != '/') if (path.Length > 0 && path[0] != '/')
path = $"/{path}"; path = $"/{path}";
return string.Concat( return string.Concat(