From 2ccda37895d4ed202c9b1af64d2a3d1d1ea8d12c Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Mon, 23 May 2016 21:22:39 +0200 Subject: [PATCH] Add commit payload --- repo_commit.go | 2 +- verification.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repo_commit.go b/repo_commit.go index 10531ff35..f3cd44461 100644 --- a/repo_commit.go +++ b/repo_commit.go @@ -74,7 +74,7 @@ l: } commit.Committer = sig case "gpgsig": - verif, err := newVerificationFromCommitline(data[nextline+spacepos+1:]) + verif, err := newVerificationFromCommitline(data, nextline+spacepos+1) if err != nil { return nil, err } diff --git a/verification.go b/verification.go index ee959a328..246aeafdf 100644 --- a/verification.go +++ b/verification.go @@ -36,11 +36,11 @@ type Verification struct { // -----END PGP SIGNATURE----- // but without the "gpgsig " at the beginning // -func newVerificationFromCommitline(line []byte) (_ *Verification, err error) { +func newVerificationFromCommitline(data []byte, signatureStart int) (_ *Verification, err error) { verif := new(Verification) - - signatureEnd := bytes.LastIndex(line, []byte("-----END PGP SIGNATURE-----")) - verif.Signature = string(line[:signatureEnd+27]) + verif.Payload = string(data[:signatureStart-8]) + signatureEnd := bytes.LastIndex(data, []byte("-----END PGP SIGNATURE-----")) + verif.Signature = string(data[signatureStart : signatureEnd+27]) return verif, nil }