mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-24 15:00:54 +00:00
Fixed: Log files should not be cached
This commit is contained in:
parent
0332356fa3
commit
33409cf7bc
3 changed files with 16 additions and 13 deletions
|
@ -6,11 +6,11 @@
|
|||
|
||||
namespace Lidarr.Http.Frontend.Mappers
|
||||
{
|
||||
public class UpdateLogFileMapper : StaticResourceMapperBase
|
||||
public class LogFileMapper : StaticResourceMapperBase
|
||||
{
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
||||
public UpdateLogFileMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
||||
public LogFileMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
||||
: base(diskProvider, logger)
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
|
@ -21,12 +21,12 @@ public override string Map(string resourceUrl)
|
|||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||
path = Path.GetFileName(path);
|
||||
|
||||
return Path.Combine(_appFolderInfo.GetUpdateLogFolder(), path);
|
||||
return Path.Combine(_appFolderInfo.GetLogFolder(), path);
|
||||
}
|
||||
|
||||
public override bool CanHandle(string resourceUrl)
|
||||
{
|
||||
return resourceUrl.StartsWith("/updatelogfile/") && resourceUrl.EndsWith(".txt");
|
||||
return resourceUrl.StartsWith("/logfile/") && resourceUrl.EndsWith(".txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
namespace Lidarr.Http.Frontend.Mappers
|
||||
{
|
||||
public class LogFileMapper : StaticResourceMapperBase
|
||||
public class UpdateLogFileMapper : StaticResourceMapperBase
|
||||
{
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
||||
public LogFileMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
||||
public UpdateLogFileMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
||||
: base(diskProvider, logger)
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
|
@ -21,12 +21,12 @@ public override string Map(string resourceUrl)
|
|||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||
path = Path.GetFileName(path);
|
||||
|
||||
return Path.Combine(_appFolderInfo.GetLogFolder(), path);
|
||||
return Path.Combine(_appFolderInfo.GetUpdateLogFolder(), path);
|
||||
}
|
||||
|
||||
public override bool CanHandle(string resourceUrl)
|
||||
{
|
||||
return resourceUrl.StartsWith("/logfile/") && resourceUrl.EndsWith(".txt");
|
||||
return resourceUrl.StartsWith("/updatelogfile/") && resourceUrl.EndsWith(".txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,23 +39,26 @@ public bool IsCacheable(HttpRequest request)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (request.Path.Value?.EndsWith("/index.js") ?? false)
|
||||
var path = request.Path.Value ?? "";
|
||||
|
||||
if (path.EndsWith("/index.js"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.Path.Value?.EndsWith("/initialize.js") ?? false)
|
||||
if (path.EndsWith("/initialize.js"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.Path.StartsWithSegments("/feed", StringComparison.CurrentCultureIgnoreCase))
|
||||
if (path.StartsWith("/feed", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.Path.StartsWithSegments("/log", StringComparison.CurrentCultureIgnoreCase) &&
|
||||
(request.Path.Value?.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase) ?? false))
|
||||
if ((path.StartsWith("/logfile", StringComparison.CurrentCultureIgnoreCase) ||
|
||||
path.StartsWith("/updatelogfile", StringComparison.CurrentCultureIgnoreCase)) &&
|
||||
path.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue