about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-02-29 09:06:54 +0000
committerRory& <root@rory.gay>2024-02-29 09:06:54 +0000
commitf447520c747c3c7a1b90232e644a917b984427e0 (patch)
tree05c7431286a5ac241a316e4888292df911f664ab
parentDump failed requests (diff)
downloadMatrixMediaGate-f447520c747c3c7a1b90232e644a917b984427e0.tar.xz
Use encoded path for storage
-rw-r--r--MatrixMediaGate/Program.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/MatrixMediaGate/Program.cs b/MatrixMediaGate/Program.cs

index 19ae4f8..e254413 100644 --- a/MatrixMediaGate/Program.cs +++ b/MatrixMediaGate/Program.cs
@@ -126,7 +126,9 @@ var jsonOptions = new JsonSerializerOptions { // We dump failed requests to disk async Task ProxyDump(ProxyConfiguration cfg, HttpContext ctx, HttpRequestMessage? req, HttpResponseMessage? resp, Exception? e) { if (ctx.Response.StatusCode >= 400 && cfg.DumpFailedRequests) { - var path = Path.Combine(cfg.DumpPath, "failed_requests", $"{resp.StatusCode}-{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}-{ctx.Request.Path}.json"); + var dir = Path.Combine(cfg.DumpPath, "failed_requests"); + Directory.CreateDirectory(dir); + var path = Path.Combine(cfg.DumpPath, "failed_requests", $"{resp.StatusCode}-{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}-{ctx.Request.GetEncodedPathAndQuery()}.json"); await using var file = File.Create(path); await JsonSerializer.SerializeAsync(file, new { Self = new {