Commit c9ab8404 authored by ale's avatar ale
Browse files

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.
parent f77712cf
Pipeline #30498 passed with stages
in 3 minutes and 59 seconds
......@@ -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
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment