summaryrefslogtreecommitdiffstats
path: root/modules/base/tool.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r--modules/base/tool.go9
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 {