mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-07 12:10:20 +02:00
Sync static resource mapper with upstream
This commit is contained in:
parent
9907342055
commit
6fca0d0b6c
3 changed files with 5 additions and 5 deletions
|
|
@ -7,6 +7,6 @@ public interface IMapHttpRequestsToDisk
|
|||
{
|
||||
string Map(string resourceUrl);
|
||||
bool CanHandle(string resourceUrl);
|
||||
Task<FileStreamResult> GetResponse(string resourceUrl);
|
||||
Task<IActionResult> GetResponse(string resourceUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ protected StaticResourceMapperBase(IDiskProvider diskProvider, Logger logger)
|
|||
|
||||
public abstract bool CanHandle(string resourceUrl);
|
||||
|
||||
public Task<FileStreamResult> GetResponse(string resourceUrl)
|
||||
public Task<IActionResult> GetResponse(string resourceUrl)
|
||||
{
|
||||
var filePath = Map(resourceUrl);
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ public Task<FileStreamResult> GetResponse(string resourceUrl)
|
|||
contentType = "application/octet-stream";
|
||||
}
|
||||
|
||||
return Task.FromResult(new FileStreamResult(GetContentStream(filePath), new MediaTypeHeaderValue(contentType)
|
||||
return Task.FromResult<IActionResult>(new FileStreamResult(GetContentStream(filePath), new MediaTypeHeaderValue(contentType)
|
||||
{
|
||||
Encoding = contentType == "text/plain" ? Encoding.UTF8 : null
|
||||
}));
|
||||
|
|
@ -50,7 +50,7 @@ public Task<FileStreamResult> GetResponse(string resourceUrl)
|
|||
|
||||
_logger.Warn("File {0} not found", filePath);
|
||||
|
||||
return Task.FromResult<FileStreamResult>(null);
|
||||
return Task.FromResult<IActionResult>(null);
|
||||
}
|
||||
|
||||
protected virtual Stream GetContentStream(string filePath)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ private async Task<IActionResult> MapResource(string path)
|
|||
|
||||
if (result != null)
|
||||
{
|
||||
if (result.ContentType == "text/html")
|
||||
if ((result as FileResult)?.ContentType == "text/html")
|
||||
{
|
||||
Response.Headers.DisableCache();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue