1
0
Fork 0
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:
flightlevel 2018-06-10 21:52:13 +10:00
parent 965da06214
commit 3d85e751b7

View file

@ -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);
}
}
}