1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

New: Serve log files as UTF-8

This commit is contained in:
Bogdan
2023-04-18 22:50:43 +03:00
committed by GitHub
parent 2303bff205
commit b303e9c21a
@@ -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 @@ namespace Sonarr.Http.Frontend.Mappers
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);