From 047862606117d839c4c46bdf8d4f47b1149e99bb Mon Sep 17 00:00:00 2001 From: saphid <4596216+saphid@users.noreply.github.com> Date: Sat, 26 Sep 2026 20:55:41 +1000 Subject: [PATCH] Reject bad redirects cleanly and ignore any icon read error Co-Authored-By: Claude Opus 5.5 (1M context) --- app/build/fetch-deps.js | 5 ++++- ui/frame_apk.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/build/fetch-deps.js b/app/build/fetch-deps.js index 89690ba..8460b06 100644 --- a/app/build/fetch-deps.js +++ b/app/build/fetch-deps.js @@ -49,7 +49,10 @@ function get(url, redirects = 5) { if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { res.resume(); if (!redirects) return reject(new Error(`${url}: too many redirects`)); - return resolve(get(new URL(res.headers.location, url).href, redirects - 1)); + let next; + try { next = new URL(res.headers.location, url).href; } + catch { return reject(new Error(`${url}: bad redirect ${res.headers.location}`)); } + return resolve(get(next, redirects - 1)); } if (res.statusCode !== 200) return reject(new Error(`${url}: HTTP ${res.statusCode}`)); const chunks = []; diff --git a/ui/frame_apk.py b/ui/frame_apk.py index 6ad8536..53fd58a 100644 --- a/ui/frame_apk.py +++ b/ui/frame_apk.py @@ -204,8 +204,8 @@ def apk_info(path): } try: info['icon_png'] = _icon_png(z, names, _icons(app.get('icon'), res)) - except (zipfile.BadZipFile, RuntimeError, OSError): - pass # a missing icon shouldn't stop the install + except Exception: # noqa: BLE001 - any unreadable icon just means no icon + pass return info