summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/ssh_key.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index 471f4cd12c..325a40a481 100644
--- a/models/ssh_key.go
+++ b/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")