From 1bc3ef63f4475680484fbbf5f776d1acfdaf6523 Mon Sep 17 00:00:00 2001 From: Archangel Date: Fri, 19 Sep 2025 15:27:31 +0200 Subject: [PATCH] Send content length as a header for files --- Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs index f077886d..ee70ed61 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs @@ -12,7 +12,10 @@ public class HttpFileUtil(HttpServerHelper httpServerHelper) var pathSlice = filePath.Split("/"); var mimePath = httpServerHelper.GetMimeText(pathSlice[^1].Split(".")[^1]); var type = string.IsNullOrWhiteSpace(mimePath) ? httpServerHelper.GetMimeText("txt") : mimePath; + var fileInfo = new FileInfo(filePath); resp.Headers.Append("Content-Type", type); + resp.Headers.Append("Content-Length", fileInfo.Length.ToString()); + await resp.SendFileAsync(filePath, CancellationToken.None); } }