Check if calendar URL is a file path or a URL

This commit is contained in:
Ryan Mwangi 2024-11-04 13:46:44 +03:00
parent 3f3766138e
commit 978ddb9ebc
1 changed files with 3 additions and 1 deletions

View File

@ -43,8 +43,10 @@ app.post('/merge', async (req, res) => {
const sanitizedLinkGroupName = sanitizeFilename(linkGroupName); const sanitizedLinkGroupName = sanitizeFilename(linkGroupName);
const filename = `${sanitizedLinkGroupName}.ics`; const filename = `${sanitizedLinkGroupName}.ics`;
// Fetch calendar data from URLs // Fetch calendar data from URLs or load from local files
const promises = calendars.map((calendar) => { const promises = calendars.map((calendar) => {
// Check if calendar URL is a file path or a URL
const isFilePath = !calendar.url.startsWith('http');
return axios.get(calendar.url) return axios.get(calendar.url)
.then((response) => { .then((response) => {
return { return {