allow filters with long tags (the 1-char restriction is only a convention, not a rule).

fixes https://github.com/fiatjaf/nak/issues/44
This commit is contained in:
fiatjaf 2024-11-26 12:05:38 -03:00
parent dd0ef2ca64
commit f425097c5a
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ var count = &cli.Command{
tags := make([][]string, 0, 5) tags := make([][]string, 0, 5)
for _, tagFlag := range c.StringSlice("tag") { for _, tagFlag := range c.StringSlice("tag") {
spl := strings.SplitN(tagFlag, "=", 2) spl := strings.SplitN(tagFlag, "=", 2)
if len(spl) == 2 && len(spl[0]) == 1 { if len(spl) == 2 {
tags = append(tags, spl) tags = append(tags, spl)
} else { } else {
return fmt.Errorf("invalid --tag '%s'", tagFlag) return fmt.Errorf("invalid --tag '%s'", tagFlag)

2
req.go
View File

@ -232,7 +232,7 @@ func applyFlagsToFilter(c *cli.Command, filter *nostr.Filter) error {
tags := make([][]string, 0, 5) tags := make([][]string, 0, 5)
for _, tagFlag := range c.StringSlice("tag") { for _, tagFlag := range c.StringSlice("tag") {
spl := strings.SplitN(tagFlag, "=", 2) spl := strings.SplitN(tagFlag, "=", 2)
if len(spl) == 2 && len(spl[0]) == 1 { if len(spl) == 2 {
tags = append(tags, spl) tags = append(tags, spl)
} else { } else {
return fmt.Errorf("invalid --tag '%s'", tagFlag) return fmt.Errorf("invalid --tag '%s'", tagFlag)