Skip to content

Commit 73048fa

Browse files
committed
Add commit payload
1 parent f158aa0 commit 73048fa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

repo_commit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ l:
7474
}
7575
commit.Committer = sig
7676
case "gpgsig":
77-
verif, err := newVerificationFromCommitline(data[nextline+spacepos+1:])
77+
verif, err := newVerificationFromCommitline(data, nextline+spacepos+1)
7878
if err != nil {
7979
return nil, err
8080
}

verification.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ type Verification struct {
3636
// -----END PGP SIGNATURE-----
3737
// but without the "gpgsig " at the beginning
3838
//
39-
func newVerificationFromCommitline(line []byte) (_ *Verification, err error) {
39+
func newVerificationFromCommitline(data []byte, signatureStart int) (_ *Verification, err error) {
4040
verif := new(Verification)
41-
42-
signatureEnd := bytes.LastIndex(line, []byte("-----END PGP SIGNATURE-----"))
43-
verif.Signature = string(line[:signatureEnd+27])
41+
verif.Payload = string(data[:signatureStart-8])
42+
signatureEnd := bytes.LastIndex(data, []byte("-----END PGP SIGNATURE-----"))
43+
verif.Signature = string(data[signatureStart : signatureEnd+27])
4444

4545
return verif, nil
4646
}

0 commit comments

Comments
 (0)