refactor: refactor sanitizeFilename utility that ensures valid file names
This commit is contained in:
parent
cf10a62049
commit
af74d809c4
|
@ -0,0 +1,46 @@
|
|||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//sebbo.net//ical-generator//EN
|
||||
NAME:test
|
||||
X-WR-CALNAME:test
|
||||
BEGIN:VEVENT
|
||||
UID:881z@Ryan-jr
|
||||
SEQUENCE:0
|
||||
DTSTAMP:20241107T111355Z
|
||||
DTSTART:20240930T113000Z
|
||||
DTEND:20240930T123000Z
|
||||
SUMMARY:work other work
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:lhyi@Ryan-jr
|
||||
SEQUENCE:0
|
||||
DTSTAMP:20241107T111355Z
|
||||
DTSTART:20241003T190000Z
|
||||
DTEND:20241003T200000Z
|
||||
SUMMARY:work progodessey
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:5l54@Ryan-jr
|
||||
SEQUENCE:0
|
||||
DTSTAMP:20241107T111355Z
|
||||
DTSTART:20241009T173000Z
|
||||
DTEND:20241009T183000Z
|
||||
SUMMARY:work do
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:cp96@Ryan-jr
|
||||
SEQUENCE:0
|
||||
DTSTAMP:20241107T111355Z
|
||||
DTSTART:20241001T183000Z
|
||||
DTEND:20241001T193000Z
|
||||
SUMMARY:Other work calmerge
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:jxsj@Ryan-jr
|
||||
SEQUENCE:0
|
||||
DTSTAMP:20241107T111355Z
|
||||
DTSTART:20241010T173000Z
|
||||
DTEND:20241010T183000Z
|
||||
SUMMARY:Other work to do
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"linkGroupName": "test",
|
||||
"calendars": [
|
||||
{
|
||||
"prefix": "work",
|
||||
"override": false,
|
||||
"url": "https://calendar.google.com/calendar/ical/b4c66eb4bb2cc15257d071bab3f935385778b042112ea1aaedada47f3f1a6e3a%40group.calendar.google.com/public/basic.ics"
|
||||
},
|
||||
{
|
||||
"prefix": "Other work",
|
||||
"override": false,
|
||||
"url": "https://calendar.google.com/calendar/ical/774518759e4e2dd42aab0c511b02397bb216f3b67dc425d76bae07d1eff529d6%40group.calendar.google.com/public/basic.ics"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -18,10 +18,8 @@ fs.mkdirSync(MERGED_CALENDARS_DIR, { recursive: true });
|
|||
app.get('/script.js', (req, res) => res.sendFile('script.js', { root: '.' }));
|
||||
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
|
||||
}
|
||||
// Utility to sanitize filenames
|
||||
const sanitizeFilename = (filename) => filename.replace(/[<>:"/\\|?* ]/g, '_');
|
||||
|
||||
// Merge calendars endpoint
|
||||
app.post('/merge', async (req, res) => {
|
||||
|
|
Loading…
Reference in New Issue