about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-02-29 09:13:59 +0000
committerRory& <root@rory.gay>2024-02-29 09:13:59 +0000
commit00fd35ac50a7ff6f17d2bf78fcf6bf2ac0a40220 (patch)
tree3f1aade4b1f0ffd8096ee8afae0d160000abc6cc
parentUse encoded path for storage (diff)
downloadMatrixMediaGate-00fd35ac50a7ff6f17d2bf78fcf6bf2ac0a40220.tar.xz
Escape path separator when dumping
-rw-r--r--MatrixMediaGate/Program.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/MatrixMediaGate/Program.cs b/MatrixMediaGate/Program.cs
index e254413..bdf0d36 100644
--- a/MatrixMediaGate/Program.cs
+++ b/MatrixMediaGate/Program.cs
@@ -128,7 +128,7 @@ async Task ProxyDump(ProxyConfiguration cfg, HttpContext ctx, HttpRequestMessage
     if (ctx.Response.StatusCode >= 400 && cfg.DumpFailedRequests) {
         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");
+        var path = Path.Combine(dir, $"{resp.StatusCode}-{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}-{ctx.Request.GetEncodedPathAndQuery().Replace('/','_')}.json");
         await using var file = File.Create(path);
         await JsonSerializer.SerializeAsync(file, new {
             Self = new {