fix(plugin): guard non-numeric appId, improve 404 error handling

This commit is contained in:
2026-07-13 06:01:08 +08:00
parent 7e016bfa50
commit ed0ed6b089
3 changed files with 9 additions and 3 deletions
+5 -1
View File
@@ -872,8 +872,12 @@ exec mangohud "$@"
return {"error": "Invalid JSON", "status": response.status}
except urllib.error.HTTPError as e:
try:
err = json.loads(e.read().decode("utf-8"))
raw_body = e.read().decode("utf-8")
try:
err = json.loads(raw_body)
return {**err, "status": e.code}
except json.JSONDecodeError:
return {"error": f"Server returned status {e.code} (non-JSON response)", "status": e.code, "body": raw_body[:200]}
except Exception:
return {"error": f"Server returned status {e.code}", "status": e.code}
except urllib.error.URLError as e:
@@ -112,7 +112,7 @@ export default function LibraryAppPanel({ appId, title, hardwareSlug, baseUrl }:
<PanelSection title="DeckyVault">
<PanelSectionRow>
<div className={staticClasses.Text} style={{ fontSize: "12px", padding: "6px 0", opacity: 0.7, color: "#e74c3c" }}>
<FaTimes /> Could not load DeckyVault data. Please try again later.
<FaTimes /> Could not load DeckyVault data: {fetchError}
</div>
</PanelSectionRow>
</PanelSection>
@@ -54,6 +54,8 @@ export function registerLibraryAppPatch() {
if (!child) return null
const overview = child.props.children.props.overview
if (!overview || !isSteamGameType(overview.app_type)) return null
// Only inject for valid numeric app IDs
if (typeof overview.appid !== 'number' || overview.appid <= 0) return null
return child.props.children
},
],