From d40bdc39f25926e84da7c4ea0cfc3192ee0f1881 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 23 Aug 2023 17:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=A7=A3=E6=9E=90=3D?= =?UTF-8?q?=E5=8F=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/parse/parse.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/parse/parse.go b/core/parse/parse.go index c570f9b..8ae3f0c 100644 --- a/core/parse/parse.go +++ b/core/parse/parse.go @@ -74,6 +74,9 @@ func Decode(data []byte, body *model.Body) error { if idx == -1 { idx = strings.LastIndex(name, "\x00") } + if idx == -1 { + idx = strings.LastIndex(name, "\xe2") + } if idx > 0 { name = name[idx+1:] @@ -87,11 +90,13 @@ func Decode(data []byte, body *model.Body) error { // 解析data KEY body.Data = make(map[string]string) for i := 1; i < len(multi); i++ { - m := strings.Split(multi[i], "=") - if len(m) != 2 { - return errors.New("invalid msg body") + str := multi[i] + idx := strings.Index(str, "=") + if idx > 0 { + key := str[:idx] + value := str[idx+1:] + body.Data[key] = value } - body.Data[m[0]] = m[1] } return nil