mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 00:59:07 -04:00
fix bug with kind being set to zero and replaced silently.
This commit is contained in:
parent
795e98bc2e
commit
6a7a5eb26e
9
event.go
9
event.go
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/nbd-wtf/go-nostr/nip19"
|
||||
"github.com/nbd-wtf/go-nostr/nson"
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
const CATEGORY_EVENT_FIELDS = "EVENT FIELDS"
|
||||
|
@ -129,20 +130,20 @@ example:
|
|||
Tags: make(nostr.Tags, 0, 3),
|
||||
}
|
||||
|
||||
kindWasSupplied := true
|
||||
mustRehashAndResign := false
|
||||
if stdinEvent != "" {
|
||||
if err := json.Unmarshal([]byte(stdinEvent), &evt); err != nil {
|
||||
lineProcessingError(c, "invalid event received from stdin: %s", err)
|
||||
continue
|
||||
}
|
||||
kindWasSupplied = strings.Contains(stdinEvent, `"kind"`)
|
||||
}
|
||||
kindWasSupplied = slices.Contains(c.FlagNames(), "kind")
|
||||
|
||||
if kind := c.Int("kind"); kind != 0 {
|
||||
if kind := c.Int("kind"); kindWasSupplied {
|
||||
evt.Kind = kind
|
||||
mustRehashAndResign = true
|
||||
} else if evt.Kind == 0 {
|
||||
evt.Kind = 1
|
||||
mustRehashAndResign = true
|
||||
}
|
||||
|
||||
if content := c.String("content"); content != "" {
|
||||
|
|
Loading…
Reference in New Issue
Block a user