From a2c24199b01ce7f16c8002073dcef08b2e7af4a4 Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:02:35 +0200 Subject: [PATCH] private-access returns null on missing user --- api-renamed/private-access.js | 1 - src/common/database.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api-renamed/private-access.js b/api-renamed/private-access.js index 14bd57d8..c7957164 100644 --- a/api-renamed/private-access.js +++ b/api-renamed/private-access.js @@ -15,4 +15,3 @@ export default async (req, res) => { res.send("Something went wrong: " + err.message); } }; - diff --git a/src/common/database.js b/src/common/database.js index 08aeca37..20572c4e 100644 --- a/src/common/database.js +++ b/src/common/database.js @@ -199,7 +199,7 @@ export async function deleteUser(userKey) { */ export async function hasPrivateAccess(userKey) { if (!pool) { - return false; + return null; } const query = ` @@ -211,12 +211,12 @@ export async function hasPrivateAccess(userKey) { try { const { rows } = await pool.query(query, [userKey]); if (rows.length === 0) { - return false; + return null; } return rows[0].private_access; } catch (err) { if (err.code === "42P01") { - return false; + return null; } else { throw err; }