From 489b57dbb86edf79603758e5b0a1c5697026a995 Mon Sep 17 00:00:00 2001 From: Brendonovich <14191578+Brendonovich@users.noreply.github.com> Date: Sat, 31 Oct 2026 16:51:58 +0000 Subject: [PATCH] fix(app): don't crash settings when the server returns a non-array config --- packages/app/src/settings/general/controllers.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/app/src/settings/general/controllers.ts b/packages/app/src/settings/general/controllers.ts index 6a27226f47b..2b21a8f1cc8 100644 --- a/packages/app/src/settings/general/controllers.ts +++ b/packages/app/src/settings/general/controllers.ts @@ -33,9 +33,17 @@ export function createServerShellController(server: Accessor { const context = serverCtx() + // The client does not validate response shapes, so an incompatible server can return a + // non-array 200 body; treat it like a failed request instead of crashing the page. const [entries, shells] = await Promise.all([ - context.sdk.api.config.get().catch(() => []), - context.sdk.api.config.shells().catch(() => []), + context.sdk.api.config + .get() + .then((value) => (Array.isArray(value) ? value : [])) + .catch(() => []), + context.sdk.api.config + .shells() + .then((value) => (Array.isArray(value) ? value : [])) + .catch(() => []), ]) const boundary = entries.findIndex((entry) => entry.type === "directory")