mirror of
https://github.com/fiatjaf/khatru.git
synced 2025-11-19 18:46:44 +01:00
lmdbn/badgern: fix for tag array crashes on query planner.
This commit is contained in:
@@ -248,7 +248,14 @@ func prepareQueries(filter nostr.Filter) (
|
|||||||
extraFilter = &nostr.Filter{Tags: filter.Tags}
|
extraFilter = &nostr.Filter{Tags: filter.Tags}
|
||||||
} else if len(filter.Tags) > 0 {
|
} else if len(filter.Tags) > 0 {
|
||||||
index = indexTagPrefix
|
index = indexTagPrefix
|
||||||
queries = make([]query, len(filter.Tags))
|
|
||||||
|
// determine the size of the queries array by inspecting all tags sizes
|
||||||
|
size := 0
|
||||||
|
for _, values := range filter.Tags {
|
||||||
|
size += len(values)
|
||||||
|
}
|
||||||
|
queries = make([]query, size)
|
||||||
|
|
||||||
extraFilter = &nostr.Filter{Kinds: filter.Kinds}
|
extraFilter = &nostr.Filter{Kinds: filter.Kinds}
|
||||||
i := 0
|
i := 0
|
||||||
for _, values := range filter.Tags {
|
for _, values := range filter.Tags {
|
||||||
|
|||||||
@@ -253,7 +253,14 @@ func (b *LMDBBackend) prepareQueries(filter nostr.Filter) (
|
|||||||
extraFilter = &nostr.Filter{Tags: filter.Tags}
|
extraFilter = &nostr.Filter{Tags: filter.Tags}
|
||||||
} else if len(filter.Tags) > 0 {
|
} else if len(filter.Tags) > 0 {
|
||||||
dbi = b.indexTag
|
dbi = b.indexTag
|
||||||
queries = make([]query, len(filter.Tags))
|
|
||||||
|
// determine the size of the queries array by inspecting all tags sizes
|
||||||
|
size := 0
|
||||||
|
for _, values := range filter.Tags {
|
||||||
|
size += len(values)
|
||||||
|
}
|
||||||
|
queries = make([]query, size)
|
||||||
|
|
||||||
extraFilter = &nostr.Filter{Kinds: filter.Kinds}
|
extraFilter = &nostr.Filter{Kinds: filter.Kinds}
|
||||||
i := 0
|
i := 0
|
||||||
for _, values := range filter.Tags {
|
for _, values := range filter.Tags {
|
||||||
|
|||||||
Reference in New Issue
Block a user