From 63b1e9b07991d8bf58de63f3a27ef6d7305600c9 Mon Sep 17 00:00:00 2001
From: Ryan Mwangi <ryannganga13325@gmail.com>
Date: Mon, 28 Oct 2024 15:08:25 +0300
Subject: [PATCH] remove second declaration of the filename

---
 server.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/server.js b/server.js
index 3a238e3..93815cb 100644
--- a/server.js
+++ b/server.js
@@ -39,7 +39,7 @@ app.post('/merge', async (req, res) => {
         if (!linkGroupName || !calendars || !Array.isArray(calendars) || calendars.length === 0) {
             return res.status(400).json({ error: 'Invalid input. Please provide a linkGroupName and at least one calendar.' });
         }
-        
+
         // Sanitize the linkGroupName to create a valid filename
         const sanitizedLinkGroupName = sanitizeFilename(linkGroupName);
         const filename = `${sanitizedLinkGroupName}.ics`;
@@ -86,8 +86,7 @@ app.post('/merge', async (req, res) => {
             });
         });
 
-        // Save merged calendar to .ics file with unique identifier
-        const filename = `${calendarId}.ics`;
+        // Save merged calendar to .ics file with the sanitized linkGroupName
         let icalString = `BEGIN:VCALENDAR
 VERSION:2.0
 CALSCALE:GREGORIAN