fix #3984 - error when file path not specified

This commit is contained in:
sbwalker
2024-03-13 17:54:25 -04:00
parent bcad5eda81
commit 5a2b9b60e6
2 changed files with 75 additions and 64 deletions

View File

@ -28,11 +28,14 @@ namespace Oqtane.Shared
// Id=1 Id=1#5 reload#5 reload
// #5
if (!url.StartsWith("/")) // paths always start with "/"
if (!url.Contains("://"))
{
url = ((!url.StartsWith("#")) ? "/?" : "/") + url;
if (!url.StartsWith("/")) // urlparameters always start with "/"
{
url = ((!url.StartsWith("#")) ? "?" : "/") + url;
}
url = Constants.PackageRegistryUrl + url; // create absolute url
}
url = ((!url.Contains("://")) ? Constants.PackageRegistryUrl : "") + url;
var uri = new Uri(url);
var querystring = uri.Query.Replace("?", "");
@ -50,7 +53,7 @@ namespace Oqtane.Shared
public static (string Path, string Parameters) ParsePath(string url)
{
url = (!url.StartsWith("/") ? "/" : "") + url;
url = ((!url.StartsWith("/") && !url.Contains("://")) ? "/" : "") + url;
(string path, string querystring, string fragment) = ParseParameters(url);