From f1a2fa5dacbbb97eb8379348bd05f0b00909ec36 Mon Sep 17 00:00:00 2001 From: ciel <149575453+flyingwhit@users.noreply.github.com> Date: Mon, 2 Nov 2026 19:20:38 +0800 Subject: [PATCH] fix(channel): add limit check to qqbot response (#21859) --- internal/channels/qqbot.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/channels/qqbot.go b/internal/channels/qqbot.go index e0c60edfb8..4370f869a0 100644 --- a/internal/channels/qqbot.go +++ b/internal/channels/qqbot.go @@ -497,12 +497,12 @@ func (c *qqBotChannel) requestJSON( return err } defer resp.Body.Close() - payload, err := io.ReadAll(resp.Body) + payload, err := io.ReadAll(io.LimitReader(resp.Body, 1024*1024)) if err != nil { return err } if resp.StatusCode >= http.StatusBadRequest { - return fmt.Errorf("status: %d, response: %s", resp.StatusCode, payload) + return fmt.Errorf("status: %d, response: %.200s", resp.StatusCode, payload) } if len(bytes.TrimSpace(payload)) == 0 { return nil