From c82ffc2f56ac19cb35c7abcc6e2cbdd9aa8c2cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20L=C3=B6sche?= Date: Thu, 21 Mar 2024 15:03:39 +0100 Subject: [PATCH] Increase scanner size to 1MB for large JSON objects --- search/search.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/search/search.go b/search/search.go index 3d19124..c24f49b 100644 --- a/search/search.go +++ b/search/search.go @@ -55,6 +55,10 @@ func SearchGraph(apiEndpoint, fixToken, workspaceID, searchStr string, withEdges } scanner := bufio.NewScanner(resp.Body) + const maxTokenSize = 1024 * 1024 + buf := make([]byte, maxTokenSize) + scanner.Buffer(buf, maxTokenSize) + for scanner.Scan() { var result interface{} if err := json.Unmarshal(scanner.Bytes(), &result); err != nil {