From 5e332c4a5cba83ea00b86788278df4eabcc055a9 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Thu, 3 Apr 2025 16:10:39 -0400 Subject: [PATCH] fix: filter out empty users in auth-keys, potential headscale bug --- app/routes/settings/auth-keys.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/routes/settings/auth-keys.tsx b/app/routes/settings/auth-keys.tsx index 4137027..00a3432 100644 --- a/app/routes/settings/auth-keys.tsx +++ b/app/routes/settings/auth-keys.tsx @@ -22,15 +22,17 @@ export async function loader({ ); const preAuthKeys = await Promise.all( - users.users.map((user) => { - const qp = new URLSearchParams(); - qp.set('user', user.name); + users.users + .filter((user) => user.name?.length > 0) // Filter out any invalid users + .map((user) => { + const qp = new URLSearchParams(); + qp.set('user', user.name); - return context.client.get<{ preAuthKeys: PreAuthKey[] }>( - `v1/preauthkey?${qp.toString()}`, - session.get('api_key')!, - ); - }), + return context.client.get<{ preAuthKeys: PreAuthKey[] }>( + `v1/preauthkey?${qp.toString()}`, + session.get('api_key')!, + ); + }), ); return {