fix(githubsync): stream-parse GitHub tree JSON to prevent OOM crash on sync

This commit is contained in:
Justin Oros
2026-04-22 18:48:45 -07:00
parent 796684367f
commit 8cd6e6c522
+6 -9
View File
@@ -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;
}