From 30c1a0ff94cce6d16c8def295d185a6e1e6e60f4 Mon Sep 17 00:00:00 2001 From: ishkong <19740260+ishkong@users.noreply.github.com> Date: Sat, 23 Nov 2024 19:35:31 +0800 Subject: [PATCH] [OneBot] Correctly handle POST urlencode content being empty (#691) --- Lagrange.OneBot/Core/Network/Service/HttpService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Lagrange.OneBot/Core/Network/Service/HttpService.cs b/Lagrange.OneBot/Core/Network/Service/HttpService.cs index 72241db1a..6018a9e92 100644 --- a/Lagrange.OneBot/Core/Network/Service/HttpService.cs +++ b/Lagrange.OneBot/Core/Network/Service/HttpService.cs @@ -150,6 +150,7 @@ private async Task HandleRequestAsync(HttpListenerContext context, CancellationT var body = await reader.ReadToEndAsync(token); Log.LogReceived(_logger, identifier, body); var @params = body.Split('&') + .Where(pair => !string.IsNullOrEmpty(pair)) .Select(pair => pair.Split('=', 2)) .ToDictionary(pair => pair[0], pair => Uri.UnescapeDataString(pair[1])); payload = JsonSerializer.Serialize(new { action, @params });