From 97085073d2766de5c639ed78721b10195f9e8d30 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Thu, 19 Jun 2025 22:54:49 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix:=20Potential=20Null=20Values?= =?UTF-8?q?=20for=20Custom=20Config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/server/routes/config.js | 5 ++--- api/server/services/Config/getCustomConfig.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/server/routes/config.js b/api/server/routes/config.js index e50fb9f452..dd93037dd9 100644 --- a/api/server/routes/config.js +++ b/api/server/routes/config.js @@ -29,8 +29,6 @@ router.get('/', async function (req, res) { return; } - const config = await getCustomConfig(); - const isBirthday = () => { const today = new Date(); return today.getMonth() === 1 && today.getDate() === 11; @@ -102,7 +100,8 @@ router.get('/', async function (req, res) { }; payload.mcpServers = {}; - if (config.mcpServers) { + const config = await getCustomConfig(); + if (config?.mcpServers != null) { for (const serverName in config.mcpServers) { const serverConfig = config.mcpServers[serverName]; payload.mcpServers[serverName] = { diff --git a/api/server/services/Config/getCustomConfig.js b/api/server/services/Config/getCustomConfig.js index 0851b89a46..d1ee5c3278 100644 --- a/api/server/services/Config/getCustomConfig.js +++ b/api/server/services/Config/getCustomConfig.js @@ -57,7 +57,7 @@ const getCustomEndpointConfig = async (endpoint) => { async function createGetMCPAuthMap() { const customConfig = await getCustomConfig(); const mcpServers = customConfig?.mcpServers; - const hasCustomUserVars = Object.values(mcpServers).some((server) => server.customUserVars); + const hasCustomUserVars = Object.values(mcpServers ?? {}).some((server) => server.customUserVars); if (!hasCustomUserVars) { return; }