From: Mageti Date: Wed, 10 Dec 2014 10:01:17 +0000 (+0100) Subject: remove unused code in BasicAuthDecode X-Git-Tag: v0.9.99~1592^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e321469884c6a775fc0b639d276234daed1ef591;p=gitea.git remove unused code in BasicAuthDecode --- diff --git a/modules/base/tool.go b/modules/base/tool.go index 39d3e8abdc..3c435fbdb1 100644 --- a/modules/base/tool.go +++ b/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 {