mirror of
https://github.com/fiatjaf/nak.git
synced 2025-12-08 16:48:51 +00:00
do not fill .Content when "content" is received empty from stdin.
fixes https://github.com/fiatjaf/nak/issues/71
This commit is contained in:
3
event.go
3
event.go
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user