allow non-hex e and p tags
mostly because some clients use p tags in follow lists for whatever reason. follow lists are generally fetched by pubkey+kind so the missing index because it's not a pubkey is really nbd, and pubkey tag searches will also work with the kind.
This commit is contained in:
@@ -63,7 +63,7 @@ func (d *D) GetWordsFromContent(ev *event.E) (wordMap map[string]int) {
|
||||
!IsEntity(w) &&
|
||||
!bytes.Contains(w, []byte(".")) {
|
||||
if len(w) == 64 || len(w) == 128 {
|
||||
if _, err := hex.Dec(string(w)); !chk.E(err) {
|
||||
if _, err := hex.Dec(string(w)); err == nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +164,9 @@ func (d *D) GetEventIndexes(ev *event.E) (indices [][]byte, ser *varint.V, err e
|
||||
continue
|
||||
}
|
||||
ph := pubhash.New()
|
||||
if len(pkb) == 0 {
|
||||
continue
|
||||
}
|
||||
if err = ph.FromPubkey(pkb); chk.E(err) {
|
||||
err = nil
|
||||
continue
|
||||
|
||||
@@ -88,7 +88,7 @@ func TestGetEventIndexes(t *testing.T) {
|
||||
// check the event encodes to binary, decodes, and produces the identical canonical form
|
||||
binE := new(bytes.Buffer)
|
||||
if err = ev.MarshalWrite(binE); chk.E(err) {
|
||||
// log.I.F("bogus tags probably: %s", b)
|
||||
log.I.F("bogus tags probably: %s", b)
|
||||
encErrs++
|
||||
// events that marshal with errors have e and p tag values that aren't hex and should not be accepted
|
||||
continue
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestD_StoreEvent(t *testing.T) {
|
||||
count++
|
||||
if count%1000 == 0 {
|
||||
log.I.F("unmarshaled %d events", count)
|
||||
break
|
||||
// break
|
||||
}
|
||||
if err = d.StoreEvent(ev); chk.E(err) {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user