golang / gddo

Go Doc Dot Org
https://godoc.org
BSD 3-Clause "New" or "Revised" License
1.1k stars 265 forks source link

The password cannot be a single character #682

Closed lijun4727 closed 4 years ago

lijun4727 commented 4 years ago

file "connstring.go" exist error! (line 165)

func (p *parser) parse(original string) error { ...... if len(username) > 1 { if strings.Contains(username, "/") { return fmt.Errorf("unescaped slash in username") } }

  p.Username, err = url.QueryUnescape(username)
  if err != nil {
      return internal.WrapErrorf(err, "invalid username")
  }
  if len(password) > 1 {
             ......

}

should be: { ...... if len(username) > 0 ...... if len(password) > 0 ...... }