mirror of
1
Fork 0

Trim whitespace when adding SSH keys (fixes #2447)

This commit is contained in:
John Maguire 2016-01-31 22:00:55 -05:00
parent caa4ca46c0
commit b3e0efc0c3
1 changed files with 3 additions and 0 deletions

View File

@ -165,6 +165,9 @@ func CheckPublicKeyString(content string) (_ string, err error) {
return "", errors.New("only a single line with a single key please") 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) fields := strings.Fields(content)
if len(fields) < 2 { if len(fields) < 2 {
return "", errors.New("too less fields") return "", errors.New("too less fields")