Use relative path instead
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
</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>
|
||||
|
@ -2,6 +2,8 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
|
||||
namespace Oqtane.Shared
|
||||
{
|
||||
@ -17,14 +19,29 @@ namespace Oqtane.Shared
|
||||
|
||||
public static string NavigateUrl(string alias, string path, string parameters)
|
||||
{
|
||||
var uriBuilder = alias == string.Empty
|
||||
? new UriBuilder()
|
||||
: new UriBuilder(alias);
|
||||
if (!alias.StartsWith("/"))
|
||||
{
|
||||
alias = $"/{alias}";
|
||||
}
|
||||
|
||||
uriBuilder.Path = path;
|
||||
uriBuilder.Query = parameters;
|
||||
if (!path.StartsWith("/"))
|
||||
{
|
||||
path = $"/{path}";
|
||||
}
|
||||
|
||||
return uriBuilder.Uri.AbsoluteUri;
|
||||
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);
|
||||
}
|
||||
|
||||
public static string EditUrl(string alias, string path, int moduleid, string action, string parameters)
|
||||
|
Reference in New Issue
Block a user