Browse Source

Trim whitespace when adding SSH keys (fixes #2447)

pull/2534/head
John Maguire 9 years ago
parent
commit
b3e0efc0c3
  1. 3
      models/ssh_key.go

3
models/ssh_key.go

@ -165,6 +165,9 @@ func CheckPublicKeyString(content string) (_ string, err error) {
return "", errors.New("only a single line with a single key please")
}
// remove any unnecessary whitespace now
content = strings.TrimSpace(content)
fields := strings.Fields(content)
if len(fields) < 2 {
return "", errors.New("too less fields")

Loading…
Cancel
Save