mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 07:43:18 -05:00
fix gpg API panic when no verification (#1451)
* fix gpg API panic when no verification * fix if condition
This commit is contained in:
parent
cbeeaa1b11
commit
cf6699fb4f
1 changed files with 7 additions and 2 deletions
|
@ -45,6 +45,11 @@ func ToCommit(c *git.Commit) *api.PayloadCommit {
|
|||
committerUsername = committer.Name
|
||||
}
|
||||
verif := models.ParseCommitWithSignature(c)
|
||||
var signature, payload string
|
||||
if c.Signature != nil {
|
||||
signature = c.Signature.Signature
|
||||
payload = c.Signature.Payload
|
||||
}
|
||||
return &api.PayloadCommit{
|
||||
ID: c.ID.String(),
|
||||
Message: c.Message(),
|
||||
|
@ -63,8 +68,8 @@ func ToCommit(c *git.Commit) *api.PayloadCommit {
|
|||
Verification: &api.PayloadCommitVerification{
|
||||
Verified: verif.Verified,
|
||||
Reason: verif.Reason,
|
||||
Signature: c.Signature.Signature,
|
||||
Payload: c.Signature.Payload,
|
||||
Signature: signature,
|
||||
Payload: payload,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue