From ad7010e506bf1988ee430824a91d10a67331d31b Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 11 Jan 2024 21:48:54 -0300 Subject: [PATCH] use scanner.Buffer() to make stdin able to parse hellish giant events up to 256kb (the default was 64kb). --- event.go | 1 + helpers.go | 1 + 2 files changed, 2 insertions(+) diff --git a/event.go b/event.go index 59e6ec3..6f456fa 100644 --- a/event.go +++ b/event.go @@ -169,6 +169,7 @@ example: tags = append(tags, tag) } } + for _, etag := range c.StringSlice("e") { tags = append(tags, []string{"e", etag}) mustRehashAndResign = true diff --git a/helpers.go b/helpers.go index 971fafd..f8a2661 100644 --- a/helpers.go +++ b/helpers.go @@ -64,6 +64,7 @@ func writeStdinLinesOrNothing(ch chan string) (hasStdinLines bool) { // piped go func() { scanner := bufio.NewScanner(os.Stdin) + scanner.Buffer(make([]byte, 16*1024), 256*1024) for scanner.Scan() { ch <- strings.TrimSpace(scanner.Text()) }