use scanner.Buffer() to make stdin able to parse hellish giant events up to 256kb (the default was 64kb).

This commit is contained in:
fiatjaf 2024-01-11 21:48:54 -03:00
parent 584881266e
commit ad7010e506
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 2 additions and 0 deletions

View File

@ -169,6 +169,7 @@ example:
tags = append(tags, tag)
}
}
for _, etag := range c.StringSlice("e") {
tags = append(tags, []string{"e", etag})
mustRehashAndResign = true

View File

@ -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())
}