More strings to MongoIds
Convert constructors into primary constructors Simplified logic with use of ??, ??= and method groups Cleaned up redundant conditional access qualifiers
This commit is contained in:
@@ -6,14 +6,12 @@ namespace SPTarkov.Server.Core.Utils;
|
||||
[Injectable]
|
||||
public class HttpFileUtil(HttpServerHelper httpServerHelper)
|
||||
{
|
||||
protected HttpServerHelper _httpServerHelper = httpServerHelper;
|
||||
|
||||
public async Task SendFile(HttpResponse resp, string filePath)
|
||||
{
|
||||
var pathSlice = filePath.Split("/");
|
||||
var mimePath = _httpServerHelper.GetMimeText(pathSlice[^1].Split(".")[^1]);
|
||||
var mimePath = httpServerHelper.GetMimeText(pathSlice[^1].Split(".")[^1]);
|
||||
var type = string.IsNullOrWhiteSpace(mimePath)
|
||||
? _httpServerHelper.GetMimeText("txt")
|
||||
? httpServerHelper.GetMimeText("txt")
|
||||
: mimePath;
|
||||
resp.Headers.Append("Content-Type", type);
|
||||
await resp.SendFileAsync(filePath, CancellationToken.None);
|
||||
|
||||
Reference in New Issue
Block a user