Skip to content

Commit 80cf016

Browse files
committed
fix: add more CDATA wrapping
1 parent 23a83d3 commit 80cf016

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

common/tags.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,11 @@ module.exports = function (options) {
216216
doc: 'https://tools.ietf.org/html/rfc4791#section-9.6',
217217
async resp({ event, ctx, calendar }) {
218218
const ics = await options.data.buildICS(ctx, event, calendar);
219+
// Wrap iCalendar data in CDATA to prevent XML parsing issues
220+
// This ensures that the iCalendar content is treated as character data
221+
// and not parsed as XML, preventing malformed XML errors
219222
return {
220-
[buildTag(cal, 'calendar-data')]: { $cdata: ics }
223+
[buildTag(cal, 'calendar-data')]: { '$cdata': ics }
221224
};
222225
}
223226
},

routes/calendar/calendar/calendar-multiget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = function (options) {
3737
'D:getetag': options.data.getETag(ctx, event)
3838
},
3939
{
40-
'CAL:calendar-data': ics
40+
'CAL:calendar-data': { '$cdata': ics }
4141
}
4242
]);
4343
});

routes/calendar/calendar/get.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = function (options) {
2323
'D:getetag': options.data.getETag(ctx, calendar)
2424
},
2525
{
26-
'CAL:calendar-data': ics
26+
'CAL:calendar-data': { '$cdata': ics }
2727
}
2828
]);
2929
}
@@ -52,7 +52,7 @@ module.exports = function (options) {
5252
'D:getetag': options.data.getETag(ctx, calendar)
5353
},
5454
{
55-
'CAL:calendar-data': ics
55+
'CAL:calendar-data': { '$cdata': ics }
5656
}
5757
]);
5858
};

0 commit comments

Comments
 (0)