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 {
|