From c9ab84044d4ba879ec9e10e0970ff1c9211ee9a7 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Fri, 1 Apr 2022 16:58:59 +0100 Subject: [PATCH] Handle PGP keys that have an email in the 'id' part of the uid Some keys can have an empty 'email' field, but will contain an email address in the 'id' field. --- actions_resource.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/actions_resource.go b/actions_resource.go index ad0454c1..c31d952d 100644 --- a/actions_resource.go +++ b/actions_resource.go @@ -442,8 +442,15 @@ func parseOpenPGPKey(data []byte, email string) (key *crypto.Key, err error) { var found bool var identities []string for _, identity := range entity.Identities { - identities = append(identities, identity.UserId.Email) - if identity.UserId.Email == email { + // Some keys can have an empty Email field, but will + // contain an email address in the Id field. + idEmail := identity.UserId.Email + if idEmail == "" && strings.Contains(identity.UserId.Id, "@") { + idEmail = identity.UserId.Id + } + + identities = append(identities, idEmail) + if idEmail == email { found = true break } -- GitLab