From 31208d9222df1172f6723779a79a5ca0ad4333bc Mon Sep 17 00:00:00 2001 From: bincooo Date: Sat, 28 Dec 2024 16:09:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8A=E4=B8=8B=E6=96=87=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=97=B6content=E8=B6=85=E5=87=BA=E9=BB=98=E8=AE=A4ca?= =?UTF-8?q?che=20buffer=E9=95=BF=E5=BA=A6=E5=AF=BC=E8=87=B4=E5=88=86?= =?UTF-8?q?=E5=89=B2=E5=BC=82=E5=B8=B82(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/gin/response/message.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/gin/response/message.go b/core/gin/response/message.go index 1c1e48e..b8aaff2 100644 --- a/core/gin/response/message.go +++ b/core/gin/response/message.go @@ -239,7 +239,8 @@ func splitToMessages(content string, merge bool) (messages []model.Keyv[interfac } scanner := bufio.NewScanner(bytes.NewBuffer([]byte(content))) - scanner.Buffer(nil, len(content)) + // fix for bufio/scan.go:200 + scanner.Buffer(nil, max(len(content)+1, bufio.MaxScanTokenSize)) scanner.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) { if atEOF && len(data) == 0 { return