diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-14 14:12:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-14 14:12:52 +0800 |
commit | 7eb8daffa3181f6bae7aac95d536c68c6bed0e33 (patch) | |
tree | cf0a170f3251dba0502cab9e2842684271577b9d /models/error.go | |
parent | 55ae78208e38eb92d916c0b3c45c4e9cebfc14c9 (diff) | |
download | gitea-7eb8daffa3181f6bae7aac95d536c68c6bed0e33.tar.gz gitea-7eb8daffa3181f6bae7aac95d536c68c6bed0e33.zip |
Use fingerprint to check instead content for public key (#911)
* use fingerprint to check instead content for public key
* add fingerprint field for ErrKeyAlreadyExist
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/models/error.go b/models/error.go index 251c90a68d..85d250c84a 100644 --- a/models/error.go +++ b/models/error.go @@ -213,8 +213,9 @@ func (err ErrKeyNotExist) Error() string { // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error. type ErrKeyAlreadyExist struct { - OwnerID int64 - Content string + OwnerID int64 + Fingerprint string + Content string } // IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist. @@ -224,7 +225,8 @@ func IsErrKeyAlreadyExist(err error) bool { } func (err ErrKeyAlreadyExist) Error() string { - return fmt.Sprintf("public key already exists [owner_id: %d, content: %s]", err.OwnerID, err.Content) + return fmt.Sprintf("public key already exists [owner_id: %d, finter_print: %s, content: %s]", + err.OwnerID, err.Fingerprint, err.Content) } // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error. |