瀏覽代碼

remove unused code in BasicAuthDecode

Mageti 10 年之前
父節點
當前提交
e321469884
共有 1 個文件被更改,包括 2 次插入7 次删除
  1. 2 7
      modules/base/tool.go

+ 2 - 7
modules/base/tool.go

@@ -48,13 +48,8 @@ func BasicAuthDecode(encoded string) (user string, name string, err error) {
 		return user, name, err
 	}
 
-	a := strings.SplitN(string(s), ":", 2)
-	if len(a) != 2 {
-		err = errors.New("decode failed")
-	} else {
-		user, name = a[0], a[1]
-	}
-	return user, name, err
+	auth := strings.SplitN(string(s), ":", 2)
+	return auth[0], auth[1], err
 }
 
 func BasicAuthEncode(username, password string) string {