index
:
gogs.git
Gogs is a painless self-hosted Git service
log msg
author
committer
range
buildscript
main
mygogs
about
summary
refs
log
tree
commit
diff
path:
root
/
models
/
ssh_key.go
diff options
context:
1
2
3
4
5
6
7
8
9
10
15
20
25
30
35
40
space:
include
ignore
mode:
unified
ssdiff
stat only
author
John Maguire <contact@johnmaguire.me>
2016-01-31 22:00:55 -0500
committer
John Maguire <contact@johnmaguire.me>
2016-01-31 22:02:36 -0500
commit
b3e0efc0c39f231b2f32105e15b43c26cc3d32f6
(
patch
)
tree
7e906ae3c2e8f50ff348921430754264c8f2b8cc
/
models/ssh_key.go
parent
caa4ca46c0d4cb7b29e5702679b1ce70b7a2c178
(
diff
)
Trim whitespace when adding SSH keys (fixes #2447)
Diffstat
(limited to 'models/ssh_key.go')
-rw-r--r--
models/ssh_key.go
3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index 471f4cd1..325a40a4 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")