forked from ryanmwangi/CalMerger
Check if calendar URL is a file path or a URL
This commit is contained in:
parent
3f3766138e
commit
978ddb9ebc
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue