mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-25 15:08:37 +02:00
Merge remote-tracking branch 'upstream/master' into bad-route
This commit is contained in:
commit
8e15142d82
|
@ -447,7 +447,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[HttpGet("Timers/{timerId}")]
|
[HttpGet("Timers/{timerId}")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||||
public async Task<ActionResult<TimerInfoDto>> GetTimer(string timerId)
|
public async Task<ActionResult<TimerInfoDto>> GetTimer([FromRoute, Required] string timerId)
|
||||||
{
|
{
|
||||||
return await _liveTvManager.GetTimer(timerId, CancellationToken.None).ConfigureAwait(false);
|
return await _liveTvManager.GetTimer(timerId, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,11 @@ namespace Jellyfin.Server.Middleware
|
||||||
var localPath = httpContext.Request.Path.ToString();
|
var localPath = httpContext.Request.Path.ToString();
|
||||||
var baseUrlPrefix = serverConfigurationManager.Configuration.BaseUrl;
|
var baseUrlPrefix = serverConfigurationManager.Configuration.BaseUrl;
|
||||||
|
|
||||||
if (!localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(localPath, baseUrlPrefix + "/", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| string.Equals(localPath, baseUrlPrefix, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| string.IsNullOrEmpty(localPath)
|
||||||
|
|| !localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// Always redirect back to the default path if the base prefix is invalid or missing
|
// Always redirect back to the default path if the base prefix is invalid or missing
|
||||||
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
|
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
|
||||||
|
|
|
@ -125,6 +125,7 @@ namespace Jellyfin.Server.Middleware
|
||||||
switch (ex)
|
switch (ex)
|
||||||
{
|
{
|
||||||
case ArgumentException _: return StatusCodes.Status400BadRequest;
|
case ArgumentException _: return StatusCodes.Status400BadRequest;
|
||||||
|
case AuthenticationException _:
|
||||||
case SecurityException _: return StatusCodes.Status401Unauthorized;
|
case SecurityException _: return StatusCodes.Status401Unauthorized;
|
||||||
case DirectoryNotFoundException _:
|
case DirectoryNotFoundException _:
|
||||||
case FileNotFoundException _:
|
case FileNotFoundException _:
|
||||||
|
|
|
@ -93,11 +93,7 @@ namespace Jellyfin.Server
|
||||||
IWebHostEnvironment env,
|
IWebHostEnvironment env,
|
||||||
IConfiguration appConfig)
|
IConfiguration appConfig)
|
||||||
{
|
{
|
||||||
// Only add base url redirection if a base url is set.
|
app.UseBaseUrlRedirection();
|
||||||
if (!string.IsNullOrEmpty(_serverConfigurationManager.Configuration.BaseUrl))
|
|
||||||
{
|
|
||||||
app.UseBaseUrlRedirection();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wrap rest of configuration so everything only listens on BaseUrl.
|
// Wrap rest of configuration so everything only listens on BaseUrl.
|
||||||
app.Map(_serverConfigurationManager.Configuration.BaseUrl, mainApp =>
|
app.Map(_serverConfigurationManager.Configuration.BaseUrl, mainApp =>
|
||||||
|
|
Loading…
Reference in a new issue