diff --git a/static/index.html b/static/index.html
index 068ab04..adbacdd 100644
--- a/static/index.html
+++ b/static/index.html
@@ -274,8 +274,15 @@ async function init() {
window.location.href = "/login";
return;
}
+ if (!res.ok) {
+ throw new Error("Failed to load files");
+ }
var files = await res.json();
+ if (!Array.isArray(files)) {
+ throw new Error("Invalid response format");
+ }
+
var sel = document.getElementById("fileSelector");
sel.innerHTML = "";
files.forEach(function(f) {