fix(githubsync): stream-parse GitHub tree JSON to prevent OOM crash on sync
This commit is contained in:
@@ -144,17 +144,14 @@ bool fetchTree(RepoInfo& info, const std::string& pat,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String body = http.getString();
|
WiFiClient* stream = http.getStreamPtr();
|
||||||
http.end();
|
|
||||||
|
|
||||||
if (body.isEmpty()) {
|
|
||||||
LOG_ERR("GHS", "Empty response for branch %s", branches[i]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
if (deserializeJson(doc, body) != DeserializationError::Ok) {
|
DeserializationError err = deserializeJson(doc, *stream);
|
||||||
LOG_ERR("GHS", "JSON parse error");
|
http.end();
|
||||||
|
|
||||||
|
if (err != DeserializationError::Ok) {
|
||||||
|
LOG_ERR("GHS", "JSON parse error: %s", err.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user