Sync static resource mapper with upstream

This commit is contained in:
Bogdan
2026-03-30 12:36:37 +03:00
committed by retrodadson
parent 9907342055
commit 6fca0d0b6c
3 changed files with 5 additions and 5 deletions
@@ -7,6 +7,6 @@ namespace Prowlarr.Http.Frontend.Mappers
{ {
string Map(string resourceUrl); string Map(string resourceUrl);
bool CanHandle(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 abstract bool CanHandle(string resourceUrl);
public Task<FileStreamResult> GetResponse(string resourceUrl) public Task<IActionResult> GetResponse(string resourceUrl)
{ {
var filePath = Map(resourceUrl); var filePath = Map(resourceUrl);
@@ -42,7 +42,7 @@ namespace Prowlarr.Http.Frontend.Mappers
contentType = "application/octet-stream"; 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 Encoding = contentType == "text/plain" ? Encoding.UTF8 : null
})); }));
@@ -50,7 +50,7 @@ namespace Prowlarr.Http.Frontend.Mappers
_logger.Warn("File {0} not found", filePath); _logger.Warn("File {0} not found", filePath);
return Task.FromResult<FileStreamResult>(null); return Task.FromResult<IActionResult>(null);
} }
protected virtual Stream GetContentStream(string filePath) protected virtual Stream GetContentStream(string filePath)
@@ -58,7 +58,7 @@ namespace Prowlarr.Http.Frontend
if (result != null) if (result != null)
{ {
if (result.ContentType == "text/html") if ((result as FileResult)?.ContentType == "text/html")
{ {
Response.Headers.DisableCache(); Response.Headers.DisableCache();
} }