mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
Use a JSON filter to avoid crashes when checking for updates (#141)
## Summary * The JSON release data from Github contains the entire release description which can be very large * The 0.9.0 release was especially bad * Use a JSON filter to avoid deserializing anything but the necessary fields ## Additional Context * https://arduinojson.org/v7/how-to/deserialize-a-very-large-document/#filtering * Fixes https://github.com/daveallie/crosspoint-reader/issues/124
This commit is contained in:
parent
f8c0b1acea
commit
c0b83b626e
@ -27,7 +27,12 @@ OtaUpdater::OtaUpdaterError OtaUpdater::checkForUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JsonDocument doc;
|
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();
|
http.end();
|
||||||
if (error) {
|
if (error) {
|
||||||
Serial.printf("[%lu] [OTA] JSON parse failed: %s\n", millis(), error.c_str());
|
Serial.printf("[%lu] [OTA] JSON parse failed: %s\n", millis(), error.c_str());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user