Fix user ssh key exporting and tests (#37256)

1. Make sure OmitEmail won't panic
2. SSH principal keys are not for signing or authentication
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-04-17 16:57:20 +00:00
1 parent 18064f772d
commit 279bf84066
4 files changed
+54 -28

No files matched your search

+3
View File
@@ -655,6 +655,9 @@ func ShowSSHKeys(ctx *context.Context) {
// "authorized_keys" file format: "#" followed by comment line per key
buf.WriteString("# Gitea isn't a key server. The keys are exported as the user uploaded and might not have been fully verified.\n")
for i := range keys {
if keys[i].Type == asymkey_model.KeyTypePrincipal {
continue // SSH principal keys are not for signing or authentication
}
buf.WriteString(keys[i].OmitEmail())
buf.WriteString("\n")
}