diff options
author | Unknwon <u@gogs.io> | 2016-02-01 16:32:30 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-01 16:32:30 -0500 |
commit | 32efc3ec0ae7228daca6bb5cec8c1e0be068ab43 (patch) | |
tree | b7b7e2b25575b01db2086525514d5b39deb3fd59 /models | |
parent | d33ed36fb441e913a11a8f2fa71204b95cd3f168 (diff) | |
parent | b3e0efc0c39f231b2f32105e15b43c26cc3d32f6 (diff) | |
download | gitea-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.go | 8 |
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 } |