Allow adding SSH keys even if SSH server is disabled (#24025)

This is useful in case you want to use them for signature verification.

A notice is added to avoid confusion.
This commit is contained in:
Dmitry Sharshakov 2023-04-10 20:22:51 +03:00 committed by GitHub
parent d7552c27d3
commit eb397c3e63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View file

@ -16,7 +16,6 @@ import (
"strconv"
"strings"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
@ -158,10 +157,6 @@ func parseKeyString(content string) (string, error) {
// CheckPublicKeyString checks if the given public key string is recognized by SSH.
// It returns the actual public key line on success.
func CheckPublicKeyString(content string) (_ string, err error) {
if setting.SSH.Disabled {
return "", db.ErrSSHDisabled{}
}
content, err = parseKeyString(content)
if err != nil {
return "", err