diff --git a/src/Jackett/Services/ServerService.cs b/src/Jackett/Services/ServerService.cs index 81c1528bd..8a222d60a 100644 --- a/src/Jackett/Services/ServerService.cs +++ b/src/Jackett/Services/ServerService.cs @@ -77,12 +77,12 @@ namespace Jackett.Services { if (config.BasePathOverride == null || config.BasePathOverride == "") { - return "/"; + return ""; } var path = config.BasePathOverride; - if (!path.EndsWith("/")) + if (path.EndsWith("/")) { - path = path + "/"; + path = path.TrimEnd('/'); } if (!path.StartsWith("/")) { diff --git a/src/Jackett/Utils/RedirectMiddleware.cs b/src/Jackett/Utils/RedirectMiddleware.cs index d076de866..e1abf8ed6 100644 --- a/src/Jackett/Utils/RedirectMiddleware.cs +++ b/src/Jackett/Utils/RedirectMiddleware.cs @@ -18,14 +18,14 @@ namespace Jackett.Utils { if (context.Request.Path != null && context.Request.Path.HasValue && context.Request.Path.Value.StartsWith(Engine.ServerConfig.RuntimeSettings.BasePath, StringComparison.Ordinal)) { - context.Request.Path = new PathString(context.Request.Path.Value.Substring(Engine.ServerConfig.RuntimeSettings.BasePath.Length - 1)); + context.Request.Path = new PathString(context.Request.Path.Value.Substring(Engine.ServerConfig.RuntimeSettings.BasePath.Length)); } if (context.Request.Path == null || string.IsNullOrWhiteSpace(context.Request.Path.ToString()) || context.Request.Path.ToString() == "/") { // 301 is the status code of permanent redirect context.Response.StatusCode = 302; - var redir = Engine.ServerConfig.RuntimeSettings.BasePath + "UI/Dashboard"; + var redir = Engine.ServerConfig.RuntimeSettings.BasePath + "/UI/Dashboard"; Engine.Logger.Info("redirecting to " + redir); context.Response.Headers.Set("Location", redir); }