From a37c875fe503b5e15f4ecc45fae5f4286b1954a8 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Mon, 16 Mar 2026 11:47:29 +0100 Subject: [PATCH] Validate firmware check --- kobopatch-wasm/test-integration.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kobopatch-wasm/test-integration.sh b/kobopatch-wasm/test-integration.sh index 12cfbad..a9964e8 100755 --- a/kobopatch-wasm/test-integration.sh +++ b/kobopatch-wasm/test-integration.sh @@ -19,7 +19,14 @@ cd "$(dirname "$0")" if [ ! -f "$FIRMWARE_FILE" ]; then echo "Downloading firmware ${FIRMWARE_VERSION} (~150MB)..." mkdir -p "$FIRMWARE_DIR" - curl -L --progress-bar -o "$FIRMWARE_FILE" "$FIRMWARE_URL" + curl -fL --progress-bar -o "$FIRMWARE_FILE.tmp" "$FIRMWARE_URL" + # Validate it's actually a zip file. + if ! file "$FIRMWARE_FILE.tmp" | grep -q "Zip archive"; then + echo "ERROR: downloaded file is not a valid zip" + rm -f "$FIRMWARE_FILE.tmp" + exit 1 + fi + mv "$FIRMWARE_FILE.tmp" "$FIRMWARE_FILE" echo "Downloaded to $FIRMWARE_FILE" else echo "Using cached firmware: $FIRMWARE_FILE"