fix: Improve JSON parsing robustness in Update_Checker
- Add error handling for malformed release notes - Parse critical fields first (tag_name, html_url) - Gracefully handle JSON parsing failures in release body - Add verbose logging for debugging API responses This fixes parsing errors when GitHub releases contain special characters.
This commit is contained in:
parent
6b867aaf77
commit
0a4ca49a49
1 changed files with 11 additions and 3 deletions
|
|
@ -287,20 +287,28 @@ default {
|
|||
updateCheckInProgress = FALSE;
|
||||
|
||||
if (status == 200) {
|
||||
// Parse GitHub release JSON
|
||||
// Parse GitHub release JSON - with robust error handling
|
||||
string latestVersion = llJsonGetValue(body, ["tag_name"]);
|
||||
string releaseNotes = llJsonGetValue(body, ["body"]);
|
||||
string htmlUrl = llJsonGetValue(body, ["html_url"]);
|
||||
string publishedAt = llJsonGetValue(body, ["published_at"]);
|
||||
|
||||
if (latestVersion == JSON_INVALID) {
|
||||
llOwnerSay("❌ Could not parse GitHub API response");
|
||||
if (VERBOSE_LOGGING) {
|
||||
llOwnerSay("🔍 Response: " + llGetSubString(body, 0, 100) + "...");
|
||||
llOwnerSay("🔍 Response preview: " + llGetSubString(body, 0, 200) + "...");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse release notes with error handling
|
||||
string releaseNotes = llJsonGetValue(body, ["body"]);
|
||||
if (releaseNotes == JSON_INVALID) {
|
||||
releaseNotes = "Release notes unavailable";
|
||||
if (VERBOSE_LOGGING) {
|
||||
llOwnerSay("⚠️ Could not parse release notes - may contain special characters");
|
||||
}
|
||||
}
|
||||
|
||||
llOwnerSay("=== 🔍 UPDATE CHECK RESULTS ===");
|
||||
llOwnerSay("📊 Current Version: v" + CURRENT_VERSION);
|
||||
llOwnerSay("✨ Latest GitHub Release: " + latestVersion);
|
||||
|
|
|
|||
Loading…
Reference in a new issue