From 42469cb782c1a527d53b031d35bb004fa50072cd Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Thu, 14 Dec 2023 16:43:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E6=B8=A0=E9=81=93id=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleware/auth.go b/middleware/auth.go index 193e72633..c0ff07425 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -91,11 +91,11 @@ func TokenAuth() func(c *gin.Context) { key = c.Request.Header.Get("mj-api-secret") key = strings.TrimPrefix(key, "Bearer ") key = strings.TrimPrefix(key, "sk-") - parts := strings.Split(key, "-") + parts = strings.Split(key, "-") key = parts[0] } else { key = strings.TrimPrefix(key, "sk-") - parts := strings.Split(key, "-") + parts = strings.Split(key, "-") key = parts[0] } token, err := model.ValidateUserToken(key)