fix(channel): add limit check to qqbot response (#21859)

This commit is contained in:
ciel authored and GitHub committed 2026-11-02 19:20:38 +08:00
1 parent dfa72e7c0a
commit f1a2fa5dac
1 file changed
+2 -2
+2 -2
View File
@@ -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