Fix: Crash on HTML response in EventRepository and others

- Fixed: Value <! DOCTYPE cannot be converted to JSONArray in EventRepository
- Fixed: Added HTML validation in UpdateManager and DeviceRegistry
- Fixed: Improved HTTP error handling in StreamUrlResolver
- Improved: Error messages in PlayerActivity
- Bumped version to 9.4.3
This commit is contained in:
renato97
2026-01-26 21:44:07 +01:00
parent 05625ffe50
commit bac564eb4f
8 changed files with 343 additions and 26 deletions

View File

@@ -81,6 +81,15 @@ public class DeviceRegistry {
throw new IOException("HTTP " + response.code());
}
String responseText = response.body().string();
// Validar que no sea HTML antes de parsear
if (responseText != null) {
String trimmed = responseText.trim();
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
throw new IOException("El servidor devolvió HTML en lugar de JSON");
}
}
JSONObject json = new JSONObject(responseText);
JSONObject deviceJson = json.optJSONObject("device");
JSONObject verificationJson = json.optJSONObject("verification");