Skip to content

Commit

Permalink
models: split auth with strings.SplitN
Browse files Browse the repository at this point in the history
  • Loading branch information
spinlock committed Sep 18, 2017
1 parent 4169d1e commit f8bc4e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/models/etcd/etcdclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func New(addrlist string, auth string, timeout time.Duration) (*Client, error) {
}

if auth != "" {
split := strings.Split(auth, ":")
split := strings.SplitN(auth, ":", 2)
if len(split) != 2 || split[0] == "" {
return nil, errors.Errorf("invalid auth")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/zk/zkclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewWithLogfunc(addrlist string, auth string, timeout time.Duration, logfunc
logger: &zkLogger{logfunc},
}
if auth != "" {
split := strings.Split(auth, ":")
split := strings.SplitN(auth, ":", 2)
if len(split) != 2 || split[0] == "" {
return nil, errors.Errorf("invalid auth")
}
Expand Down

0 comments on commit f8bc4e3

Please sign in to comment.