verify, validate: fix the blank-stdin sentinel check, getJsonsOrBlank yields '{}' not '', so the argument forms never worked.

This commit is contained in:
Yasuhiro Matsumoto
2026-07-15 04:03:43 +09:00
parent 4fa512edf3
commit dd0b25816a
2 changed files with 4 additions and 2 deletions

View File

@@ -51,7 +51,8 @@ nak event -k 1 -p not_a_pubkey | nak validate
}
for stdinEvent := range getJsonsOrBlank() {
if stdinEvent == "" {
if stdinEvent == "{}" && !isPiped() {
// blank sentinel from getJsonsOrBlank(), use the arguments instead
for _, arg := range c.Args().Slice() {
if err := handleEvent(arg); err != nil {
ctx = lineProcessingError(ctx, "%s", err)

View File

@@ -19,7 +19,8 @@ it outputs nothing if the verification is successful.`,
Action: func(ctx context.Context, c *cli.Command) error {
for stdinEvent := range getJsonsOrBlank() {
evt := nostr.Event{}
if stdinEvent == "" {
if stdinEvent == "{}" && !isPiped() {
// blank sentinel from getJsonsOrBlank(), use the argument instead
stdinEvent = c.Args().First()
if stdinEvent == "" {
continue