mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-30 05:53:41 +02:00
Rewrite rule: Handle no path after base path
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user