From 20fb6fb92dbf5312e3353c06f051b71b604abdba Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 10 Sep 2023 12:47:20 -0700 Subject: [PATCH] Update [path].js --- src/pages/api/config/[path].js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/api/config/[path].js b/src/pages/api/config/[path].js index a7da7eec..165660e7 100644 --- a/src/pages/api/config/[path].js +++ b/src/pages/api/config/[path].js @@ -16,8 +16,7 @@ export default async function handler(req, res) { // only two supported files, for now if (!['custom.css', 'custom.js'].includes(relativePath)) { - res.status(422).end('Unsupported file') - return // do not continue in the function + return res.status(422).end('Unsupported file'); } const filePath = path.join(CONF_DIR, relativePath); @@ -28,9 +27,9 @@ export default async function handler(req, res) { // hard-coded since we only support two known files for now const mimeType = (relativePath === 'custom.css') ? 'text/css' : 'text/javascript'; res.setHeader('Content-Type', mimeType); - res.status(200).send(fileContent); + return res.status(200).send(fileContent); } catch (error) { logger.error(error); - res.status(500).end('Internal Server Error'); + return res.status(500).end('Internal Server Error'); } }