From 8cd6e6c52218ce322547e081ee8fc0c27b223c80 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Wed, 22 Apr 2026 18:48:45 -0700 Subject: [PATCH] fix(githubsync): stream-parse GitHub tree JSON to prevent OOM crash on sync --- plugins/githubsync/GitHubSyncPlugin.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/githubsync/GitHubSyncPlugin.cpp b/plugins/githubsync/GitHubSyncPlugin.cpp index 53e7636..27371cb 100644 --- a/plugins/githubsync/GitHubSyncPlugin.cpp +++ b/plugins/githubsync/GitHubSyncPlugin.cpp @@ -144,17 +144,14 @@ bool fetchTree(RepoInfo& info, const std::string& pat, continue; } - String body = http.getString(); - http.end(); - - if (body.isEmpty()) { - LOG_ERR("GHS", "Empty response for branch %s", branches[i]); - continue; - } + WiFiClient* stream = http.getStreamPtr(); JsonDocument doc; - if (deserializeJson(doc, body) != DeserializationError::Ok) { - LOG_ERR("GHS", "JSON parse error"); + DeserializationError err = deserializeJson(doc, *stream); + http.end(); + + if (err != DeserializationError::Ok) { + LOG_ERR("GHS", "JSON parse error: %s", err.c_str()); continue; }