mirror of
https://github.com/Jackett/Jackett
synced 2024-12-26 09:48:37 +00:00
Rewrite rule: Handle no path after base path
This commit is contained in:
parent
965da06214
commit
3d85e751b7
1 changed files with 6 additions and 2 deletions
|
@ -12,9 +12,13 @@ namespace Jackett.Server.Middleware
|
|||
|
||||
string serverBasePath = Helper.ServerService.BasePath() ?? string.Empty;
|
||||
|
||||
if (request.Path != null && request.Path.HasValue && serverBasePath.Length > 0 && request.Path.Value.StartsWith(serverBasePath, StringComparison.Ordinal))
|
||||
if (request.Path != null && request.Path.HasValue && serverBasePath.Length > 0
|
||||
&& (request.Path.Value.StartsWith(serverBasePath + "/", StringComparison.Ordinal)
|
||||
|| request.Path.Value.Equals(serverBasePath, StringComparison.Ordinal)))
|
||||
{
|
||||
request.Path = new PathString(request.Path.Value.Substring(serverBasePath.Length));
|
||||
string path = request.Path.Value.Substring(serverBasePath.Length);
|
||||
path = string.IsNullOrEmpty(path) ? "/" : path;
|
||||
request.Path = new PathString(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue