summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMageti <etienne@mageti.fr>2014-12-10 10:51:51 +0100
committerMageti <etienne@mageti.fr>2014-12-10 10:51:51 +0100
commitb7ebbb4064942ca5013207eb89c4e2dd045ba3ce (patch)
tree170e962f97899342ebdaf1abe6fa9c368198241f /modules
parent6f71632e3ef6c0c818b3224e501fa66583108806 (diff)
downloadgitea-b7ebbb4064942ca5013207eb89c4e2dd045ba3ce.tar.gz
gitea-b7ebbb4064942ca5013207eb89c4e2dd045ba3ce.zip
Correction for #723
Correction for #723 Bug was : decode failed if the password contains ```:```
Diffstat (limited to 'modules')
-rw-r--r--modules/base/tool.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 14c0e7d086..39d3e8abdc 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -48,11 +48,11 @@ 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 {
+ 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
}