feat(calendars): make merged calendars with .ics suffix return same calendar as the merged calendar without the .ics suffix

This commit is contained in:
ryan 2025-04-22 17:57:39 +03:00
parent 30622c611a
commit 55826b8dde
3 changed files with 9 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
node_modules/
test/calendar/
calendar/
logs/
logs/
.qodo

Binary file not shown.

View file

@ -57,7 +57,12 @@ async function refreshCalendarData(calendarName) {
// Serve the merged calendar file and refresh if older than an hour
router.get('/calendar/:name', async (req, res) => {
const calendarName = req.params.name;
// Extract the calendar name and remove .ics extension if present
let calendarName = req.params.name;
if (calendarName.endsWith('.ics')) {
calendarName = calendarName.slice(0, -4);
}
const icsFilePath = path.join(MERGED_CALENDARS_DIR, `${calendarName}.ics`);
try {
@ -82,4 +87,4 @@ router.get('/calendar/:name', async (req, res) => {
}
});
export default router;
export default router;