mirror of
https://github.com/Radarr/Radarr
synced 2026-02-06 06:43:09 +01:00
Serve plain text files (eg. logs) as UTF-8
This commit is contained in:
parent
1be450a9d0
commit
6961633cc9
1 changed files with 6 additions and 1 deletions
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
|
@ -39,7 +41,10 @@ public IActionResult GetResponse(string resourceUrl)
|
|||
contentType = "application/octet-stream";
|
||||
}
|
||||
|
||||
return new FileStreamResult(GetContentStream(filePath), contentType);
|
||||
return new FileStreamResult(GetContentStream(filePath), new MediaTypeHeaderValue(contentType)
|
||||
{
|
||||
Encoding = contentType == "text/plain" ? Encoding.UTF8 : null
|
||||
});
|
||||
}
|
||||
|
||||
_logger.Warn("File {0} not found", filePath);
|
||||
|
|
|
|||
Loading…
Reference in a new issue