From c1d6bd06b0561cb887f8374ffb4c07aceff7f55f Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 24 Jan 2018 02:19:49 +0100 Subject: [PATCH] pkg/index: fix corpus AppendClaims use of signerFilter Follow-up of ec66bcc871bcc957b3fefdab5e4397d6e4febfbc 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 --- pkg/index/corpus.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/index/corpus.go b/pkg/index/corpus.go index 4f2cce2a7..753d36174 100644 --- a/pkg/index/corpus.go +++ b/pkg/index/corpus.go @@ -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 }