From 87dc427db1489d9dda8baebc8df049f0a1f0c9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Sat, 29 Aug 2026 21:37:05 +0200 Subject: [PATCH] Add doctype/lang and harden JSON response parsing --- build.sh | 2 +- index.html.tmpl | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 0bf88f1..823ad9f 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/bin/sh set -eu -VERSION=1.1.0 +VERSION=1.1.1 GIT_SHA=$(git rev-parse --short HEAD) IMAGE="docker.sdal.tech/beam:$VERSION-$GIT_SHA" IMAGE_LATEST="docker.sdal.tech/beam:latest" diff --git a/index.html.tmpl b/index.html.tmpl index ee56b16..4ff1b0e 100644 --- a/index.html.tmpl +++ b/index.html.tmpl @@ -1,4 +1,5 @@ - + + @@ -247,8 +248,12 @@ xhr.addEventListener('load', () => { if (xhr.status === 200) { - const response = JSON.parse(xhr.responseText); - displayResults(response.urls); + try { + const response = JSON.parse(xhr.responseText); + displayResults(response.urls); + } catch (e) { + showMessage('Upload failed: Unexpected response from server'); + } } else { let message = xhr.statusText; try {