sanitize the provided linkGroupName to create a valid filename

This commit is contained in:
Ryan Mwangi 2024-10-28 15:05:49 +03:00
parent b99932b9ce
commit 0a9cddcbaa

View file

@ -40,6 +40,10 @@ app.post('/merge', async (req, res) => {
return res.status(400).json({ error: 'Invalid input. Please provide a linkGroupName and at least one calendar.' }); 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`;
// Fetch calendar data from URLs // Fetch calendar data from URLs
const promises = calendars.map((calendar) => { const promises = calendars.map((calendar) => {
return axios.get(calendar.url) return axios.get(calendar.url)