convert tags to appropriate hex pubkeys, ids etc, even from nip05, but check the tag name first for better (hardcoded) context.

This commit is contained in:
fiatjaf
2026-03-13 00:30:46 -03:00
parent 5f4efdbc69
commit c1e72e0af1
3 changed files with 35 additions and 12 deletions

12
req.go
View File

@@ -468,19 +468,23 @@ func applyFlagsToFilter(c *cli.Command, filter *nostr.Filter) error {
for _, tagFlag := range c.StringSlice("tag") {
spl := strings.SplitN(tagFlag, "=", 2)
if len(spl) == 2 {
tags = append(tags, []string{spl[0], decodeTagValue(spl[1])})
val := spl[1]
if len(spl) == 1 {
val = decodeTagValue(val, []rune(spl[0])[0])
}
tags = append(tags, []string{spl[0], val})
} else {
return fmt.Errorf("invalid --tag '%s'", tagFlag)
}
}
for _, etag := range c.StringSlice("e") {
tags = append(tags, []string{"e", decodeTagValue(etag)})
tags = append(tags, []string{"e", decodeTagValue(etag, 'e')})
}
for _, ptag := range c.StringSlice("p") {
tags = append(tags, []string{"p", decodeTagValue(ptag)})
tags = append(tags, []string{"p", decodeTagValue(ptag, 'p')})
}
for _, dtag := range c.StringSlice("d") {
tags = append(tags, []string{"d", decodeTagValue(dtag)})
tags = append(tags, []string{"d", dtag})
}
if len(tags) > 0 && filter.Tags == nil {