Address feedback

This commit is contained in:
Hisham Bin Ateya
2020-04-06 20:54:55 +03:00
parent a2f756729c
commit e10015c11a
3 changed files with 11 additions and 28 deletions

View File

@ -18,7 +18,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Text.Json" Version="4.7.1" />
</ItemGroup>

View File

@ -2,8 +2,6 @@
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
namespace Oqtane.Shared
{
@ -19,29 +17,15 @@ namespace Oqtane.Shared
public static string NavigateUrl(string alias, string path, string parameters)
{
if (!alias.StartsWith("/"))
var uriBuilder = new UriBuilder
{
alias = $"/{alias}";
}
Path = !string.IsNullOrEmpty(alias)
? $"{alias}/{path}"
: $"{path}",
Query = parameters
};
if (!path.StartsWith("/"))
{
path = $"/{path}";
}
var pathPaseValue = alias == string.Empty
? default
: new PathString(alias);
var pathValue = path == string.Empty
? default
: new PathString(path);
var queryStringValue = parameters == string.Empty
? default
: new QueryString($"?{parameters}");
return UriHelper.BuildRelative(pathPaseValue, pathValue, queryStringValue);
return uriBuilder.Uri.PathAndQuery;
}
public static string EditUrl(string alias, string path, int moduleid, string action, string parameters)