浏览代码

修复登录验证可能的越界问题

Signed-off-by: allan716 <[email protected]>
allan716 3 年之前
父节点
当前提交
e40faeb883
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      internal/backend/middle/auth.go

+ 1 - 1
internal/backend/middle/auth.go

@@ -14,7 +14,7 @@ func CheckAuth() gin.HandlerFunc {
 
 	return func(context *gin.Context) {
 		authHeader := context.Request.Header.Get("Authorization")
-		if len(authHeader) <= 1 {
+		if len(authHeader) != 2 {
 			context.JSON(http.StatusUnauthorized, backend.ReplyCheckAuth{Message: "Request Header Authorization Error"})
 			context.Abort()
 			return