summaryrefslogtreecommitdiffstats
path: root/models/publickey.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/publickey.go')
-rw-r--r--models/publickey.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/models/publickey.go b/models/publickey.go
index 400486eba7..e5516526bc 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -466,7 +466,15 @@ func deletePublicKey(e *xorm.Session, key *PublicKey) error {
}
// DeletePublicKey deletes SSH key information both in database and authorized_keys file.
-func DeletePublicKey(key *PublicKey) (err error) {
+func DeletePublicKey(id int64) (err error) {
+ key := &PublicKey{ID: id}
+ has, err := x.Id(key.ID).Get(key)
+ if err != nil {
+ return err
+ } else if !has {
+ return nil
+ }
+
sess := x.NewSession()
defer sessionRelease(sess)
if err = sess.Begin(); err != nil {