pkg/index: fix corpus AppendClaims use of signerFilter

Follow-up of ec66bcc871

This change should be the last of its kind, in the corpus at least, and
should make most searches and the web UI usable again, with both kinds
of hashes (sha1 and sha224).

Updates #537

Change-Id: Icfe9e8aaab031313612c555b7601895aeba16a7c
This commit is contained in:
mpl 2018-01-24 02:19:49 +01:00
parent c03ad46ce9
commit c1d6bd06b0
1 changed files with 16 additions and 1 deletions

View File

@ -1297,13 +1297,28 @@ func (c *Corpus) AppendClaims(ctx context.Context, dst []camtypes.Claim, permaNo
if !ok {
return nil, nil
}
var signerRefs signerRefSet
if signerFilter.Valid() {
signer, ok := c.keyId[signerFilter]
if !ok {
return dst, nil
}
signerRefs, ok = c.signerRefs[signer]
if !ok {
return dst, nil
}
}
for _, cl := range pm.Claims {
if c.IsDeleted(cl.BlobRef) {
continue
}
if signerFilter.Valid() && cl.Signer != signerFilter {
if len(signerRefs) > 0 && !signerRefs.blobMatches(cl.Signer) {
continue
}
if attrFilter != "" && cl.Attr != attrFilter {
continue
}