1
0
Fork 0

fix gpg API panic when no verification (#1451)

* fix gpg API panic when no verification

* fix if condition
This commit is contained in:
Lunny Xiao 2017-04-06 18:40:05 -07:00 committed by GitHub
parent cbeeaa1b11
commit cf6699fb4f

View file

@ -45,6 +45,11 @@ func ToCommit(c *git.Commit) *api.PayloadCommit {
committerUsername = committer.Name committerUsername = committer.Name
} }
verif := models.ParseCommitWithSignature(c) verif := models.ParseCommitWithSignature(c)
var signature, payload string
if c.Signature != nil {
signature = c.Signature.Signature
payload = c.Signature.Payload
}
return &api.PayloadCommit{ return &api.PayloadCommit{
ID: c.ID.String(), ID: c.ID.String(),
Message: c.Message(), Message: c.Message(),
@ -63,8 +68,8 @@ func ToCommit(c *git.Commit) *api.PayloadCommit {
Verification: &api.PayloadCommitVerification{ Verification: &api.PayloadCommitVerification{
Verified: verif.Verified, Verified: verif.Verified,
Reason: verif.Reason, Reason: verif.Reason,
Signature: c.Signature.Signature, Signature: signature,
Payload: c.Signature.Payload, Payload: payload,
}, },
} }
} }