summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-02-01 16:32:30 -0500
committerUnknwon <u@gogs.io>2016-02-01 16:32:30 -0500
commit32efc3ec0ae7228daca6bb5cec8c1e0be068ab43 (patch)
treeb7b7e2b25575b01db2086525514d5b39deb3fd59 /models
parentd33ed36fb441e913a11a8f2fa71204b95cd3f168 (diff)
parentb3e0efc0c39f231b2f32105e15b43c26cc3d32f6 (diff)
downloadgitea-32efc3ec0ae7228daca6bb5cec8c1e0be068ab43.tar.gz
gitea-32efc3ec0ae7228daca6bb5cec8c1e0be068ab43.zip
Merge pull request #2540 from JohnMaguire/bugfix/2447-delete-public-key-authorized_keys
Fixes #2447 (delete public key from authorized_keys)
Diffstat (limited to 'models')
-rw-r--r--models/ssh_key.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index a7b1680f67..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")
@@ -374,6 +377,11 @@ func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
break
}
}
+
+ if !isFound {
+ log.Warn("SSH key %d not found in authorized_keys file for deletion", key.ID)
+ }
+
return nil
}