|
|
@ -736,6 +736,7 @@ func ShowGPGKeys(ctx *context.Context, uid int64) { |
|
|
|
ctx.ServerError("ListGPGKeys", err) |
|
|
|
ctx.ServerError("ListGPGKeys", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
entities := make([]*openpgp.Entity, 0) |
|
|
|
entities := make([]*openpgp.Entity, 0) |
|
|
|
failedEntitiesID := make([]string, 0) |
|
|
|
failedEntitiesID := make([]string, 0) |
|
|
|
for _, k := range keys { |
|
|
|
for _, k := range keys { |
|
|
@ -755,6 +756,8 @@ func ShowGPGKeys(ctx *context.Context, uid int64) { |
|
|
|
headers := make(map[string]string) |
|
|
|
headers := make(map[string]string) |
|
|
|
if len(failedEntitiesID) > 0 { // If some key need re-import to be exported
|
|
|
|
if len(failedEntitiesID) > 0 { // If some key need re-import to be exported
|
|
|
|
headers["Note"] = fmt.Sprintf("The keys with the following IDs couldn't be exported and need to be reuploaded %s", strings.Join(failedEntitiesID, ", ")) |
|
|
|
headers["Note"] = fmt.Sprintf("The keys with the following IDs couldn't be exported and need to be reuploaded %s", strings.Join(failedEntitiesID, ", ")) |
|
|
|
|
|
|
|
} else if len(entities) == 0 { |
|
|
|
|
|
|
|
headers["Note"] = "This user hasn't uploaded any GPG keys." |
|
|
|
} |
|
|
|
} |
|
|
|
writer, _ := armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", headers) |
|
|
|
writer, _ := armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", headers) |
|
|
|
for _, e := range entities { |
|
|
|
for _, e := range entities { |
|
|
|