diff options
author | 无闻 <u@gogs.io> | 2014-12-10 05:03:50 -0500 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2014-12-10 05:03:50 -0500 |
commit | b2c6a6920fbfed4bdd5bbb47c8c7906b44e983d0 (patch) | |
tree | 7c0ae3a3635035e0c9a646811e5f39fb94ed1143 /modules/base/tool.go | |
parent | 9a1fe801e526ae1bc0a211d8a218aabcf985376d (diff) | |
parent | e321469884c6a775fc0b639d276234daed1ef591 (diff) | |
download | gitea-b2c6a6920fbfed4bdd5bbb47c8c7906b44e983d0.tar.gz gitea-b2c6a6920fbfed4bdd5bbb47c8c7906b44e983d0.zip |
Merge pull request #727 from Mageti/master
Correction for #723
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r-- | modules/base/tool.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go index 14c0e7d086..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.Split(string(s), ":") - if len(a) == 2 { - user, name = a[0], a[1] - } else { - err = errors.New("decode failed") - } - return user, name, err + auth := strings.SplitN(string(s), ":", 2) + return auth[0], auth[1], err } func BasicAuthEncode(username, password string) string { |