do not fill .Content when "content" is received empty from stdin.

fixes https://github.com/fiatjaf/nak/issues/71
This commit is contained in:
fiatjaf
2025-06-23 17:57:44 -03:00
parent 89ec8b9822
commit 1e237b4c42

View File

@@ -168,6 +168,7 @@ example:
evt.Content = "" evt.Content = ""
kindWasSupplied := strings.Contains(stdinEvent, `"kind"`) kindWasSupplied := strings.Contains(stdinEvent, `"kind"`)
contentWasSupplied := strings.Contains(stdinEvent, `"content"`)
mustRehashAndResign := false mustRehashAndResign := false
if err := easyjson.Unmarshal([]byte(stdinEvent), &evt); err != nil { if err := easyjson.Unmarshal([]byte(stdinEvent), &evt); err != nil {
@@ -194,7 +195,7 @@ example:
evt.Content = content evt.Content = content
} }
mustRehashAndResign = true mustRehashAndResign = true
} else if evt.Content == "" && evt.Kind == 1 { } else if !contentWasSupplied && evt.Content == "" && evt.Kind == 1 {
evt.Content = "hello from the nostr army knife" evt.Content = "hello from the nostr army knife"
mustRehashAndResign = true mustRehashAndResign = true
} }