From ad4f2faacaf79d6f43c7d3c00362396d9a6bc6c0 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Mon, 28 Oct 2024 15:02:13 +0300 Subject: [PATCH] create function to santize the linkGroupName for use as a filename --- server.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.js b/server.js index 04e7819..96c9504 100644 --- a/server.js +++ b/server.js @@ -25,6 +25,11 @@ app.get('/', (req, res) => { res.sendFile('index.html', { root: '.' }); }); +// Function to sanitize the linkGroupName for use as a filename +function sanitizeFilename(filename) { + return filename.replace(/[<>:"/\\|?*]/g, '_'); // Replace invalid characters with underscores +} + // Merge calendars endpoint app.post('/merge', async (req, res) => { const { linkGroupName, calendars } = req.body;