From f56696d153a503656f37806a5cb672f88f389141 Mon Sep 17 00:00:00 2001 From: fulldump Date: Sat, 18 Oct 2025 03:11:27 +0200 Subject: [PATCH] use json2 and reuse command --- collection/collection.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/collection/collection.go b/collection/collection.go index 281c807..88ee2e9 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -86,10 +86,17 @@ func OpenCollection(filename string) (*Collection, error) { encoderMutex: &sync.Mutex{}, } - j := json.NewDecoder(f) + j := jsontext.NewDecoder(f, + jsontext.AllowDuplicateNames(true), + jsontext.AllowInvalidUTF8(true), + ) + + command := &Command{} + for { - command := &Command{} - err := j.Decode(&command) + command.Payload = nil + + err := json2.UnmarshalDecode(j, &command) if err == io.EOF { break }