Use a JSON filter to avoid crashes when checking for updates

The source data can be quite large if the release description is large
Fixes https://github.com/daveallie/crosspoint-reader/issues/124
This commit is contained in:
Dave Allie 2025-12-29 02:24:20 +11:00
parent f8c0b1acea
commit fb0b82c4d9
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F

View File

@ -27,7 +27,12 @@ OtaUpdater::OtaUpdaterError OtaUpdater::checkForUpdate() {
}
JsonDocument doc;
const DeserializationError error = deserializeJson(doc, *client);
JsonDocument filter;
filter["tag_name"] = true;
filter["assets"][0]["name"] = true;
filter["assets"][0]["browser_download_url"] = true;
filter["assets"][0]["size"] = true;
const DeserializationError error = deserializeJson(doc, *client, DeserializationOption::Filter(filter));
http.end();
if (error) {
Serial.printf("[%lu] [OTA] JSON parse failed: %s\n", millis(), error.c_str());