summaryrefslogtreecommitdiffstats
path: root/models/asymkey
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-06-05 03:18:50 +0800
committerGitHub <noreply@github.com>2022-06-04 20:18:50 +0100
commit12c742f8dc25e4148c44d1265d119c35f161bf74 (patch)
tree0c35f1de4cf7bdea1dfc8b03468f3616d0c82796 /models/asymkey
parent449ea6005fb613212102126ff267f5c16f7c40b8 (diff)
downloadgitea-12c742f8dc25e4148c44d1265d119c35f161bf74.tar.gz
gitea-12c742f8dc25e4148c44d1265d119c35f161bf74.zip
Fix order by parameter (#19849)
Upgrade builder to v0.3.11 Upgrade xorm to v1.3.1 and fixed some hidden bugs. Replace #19821 Replace #19834 Included #19850 Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/asymkey')
-rw-r--r--models/asymkey/ssh_key.go4
-rw-r--r--models/asymkey/ssh_key_deploy.go2
-rw-r--r--models/asymkey/ssh_key_fingerprint.go3
3 files changed, 5 insertions, 4 deletions
diff --git a/models/asymkey/ssh_key.go b/models/asymkey/ssh_key.go
index 10220ea937..107a29e985 100644
--- a/models/asymkey/ssh_key.go
+++ b/models/asymkey/ssh_key.go
@@ -77,7 +77,7 @@ func (key *PublicKey) AuthorizedString() string {
func addKey(ctx context.Context, key *PublicKey) (err error) {
if len(key.Fingerprint) == 0 {
- key.Fingerprint, err = calcFingerprint(key.Content)
+ key.Fingerprint, err = CalcFingerprint(key.Content)
if err != nil {
return err
}
@@ -95,7 +95,7 @@ func addKey(ctx context.Context, key *PublicKey) (err error) {
func AddPublicKey(ownerID int64, name, content string, authSourceID int64) (*PublicKey, error) {
log.Trace(content)
- fingerprint, err := calcFingerprint(content)
+ fingerprint, err := CalcFingerprint(content)
if err != nil {
return nil, err
}
diff --git a/models/asymkey/ssh_key_deploy.go b/models/asymkey/ssh_key_deploy.go
index 9a97d37f93..22fcefff69 100644
--- a/models/asymkey/ssh_key_deploy.go
+++ b/models/asymkey/ssh_key_deploy.go
@@ -116,7 +116,7 @@ func HasDeployKey(keyID, repoID int64) bool {
// AddDeployKey add new deploy key to database and authorized_keys file.
func AddDeployKey(repoID int64, name, content string, readOnly bool) (*DeployKey, error) {
- fingerprint, err := calcFingerprint(content)
+ fingerprint, err := CalcFingerprint(content)
if err != nil {
return nil, err
}
diff --git a/models/asymkey/ssh_key_fingerprint.go b/models/asymkey/ssh_key_fingerprint.go
index 283b3d3b64..747a7e6473 100644
--- a/models/asymkey/ssh_key_fingerprint.go
+++ b/models/asymkey/ssh_key_fingerprint.go
@@ -76,7 +76,8 @@ func calcFingerprintNative(publicKeyContent string) (string, error) {
return ssh.FingerprintSHA256(pk), nil
}
-func calcFingerprint(publicKeyContent string) (string, error) {
+// CalcFingerprint calculate public key's fingerprint
+func CalcFingerprint(publicKeyContent string) (string, error) {
// Call the method based on configuration
var (
fnName, fp string