mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-15 21:24:46 -04:00
Sync static resource mapper with upstream
This commit is contained in:
@@ -7,6 +7,6 @@ namespace Prowlarr.Http.Frontend.Mappers
|
||||
{
|
||||
string Map(string resourceUrl);
|
||||
bool CanHandle(string resourceUrl);
|
||||
Task<FileStreamResult> GetResponse(string resourceUrl);
|
||||
Task<IActionResult> GetResponse(string resourceUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Prowlarr.Http.Frontend.Mappers
|
||||
|
||||
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 @@ namespace Prowlarr.Http.Frontend.Mappers
|
||||
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 @@ namespace Prowlarr.Http.Frontend.Mappers
|
||||
|
||||
_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 @@ namespace Prowlarr.Http.Frontend
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
if (result.ContentType == "text/html")
|
||||
if ((result as FileResult)?.ContentType == "text/html")
|
||||
{
|
||||
Response.Headers.DisableCache();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user