caldav-adapter 8.2.7 → 8.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "caldav-adapter",
3
3
  "description": "CalDAV server for Node.js and Koa. Modernized and maintained for Forward Email.",
4
- "version": "8.2.7",
4
+ "version": "8.2.8",
5
5
  "author": "Sanders DeNardi and Forward Email LLC",
6
6
  "contributors": [
7
7
  "Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",
@@ -1,29 +1,5 @@
1
1
  const { setMissingMethod } = require('../../../common/response');
2
2
  const winston = require('../../../common/winston');
3
- const {
4
- response,
5
- status,
6
- build,
7
- multistatus
8
- } = require('../../../common/x-build');
9
-
10
- /**
11
- * Encode special characters for XML content to prevent parsing errors
12
- * @param {string} str - String to encode
13
- * @returns {string} - XML-safe encoded string
14
- */
15
- function encodeXMLEntities(str) {
16
- if (typeof str !== 'string') {
17
- return str;
18
- }
19
-
20
- return str
21
- .replaceAll('&', '&amp;') // Must be first to avoid double-encoding
22
- .replaceAll('<', '&lt;')
23
- .replaceAll('>', '&gt;')
24
- .replaceAll('"', '&quot;')
25
- .replaceAll("'", '&#39;');
26
- }
27
3
 
28
4
  module.exports = function (options) {
29
5
  const log = winston({ ...options, label: 'calendar/get' });
@@ -39,21 +15,6 @@ module.exports = function (options) {
39
15
 
40
16
  const ics = await options.data.buildICS(ctx, events, calendar);
41
17
 
42
- const accept = ctx.accepts(['text/xml', 'text/calendar']);
43
-
44
- if (accept === 'text/xml') {
45
- const responseObj = response(ctx.url, status[200], [
46
- {
47
- 'D:getetag': options.data.getETag(ctx, calendar)
48
- },
49
- {
50
- 'CAL:calendar-data': encodeXMLEntities(ics)
51
- }
52
- ]);
53
- return build(multistatus([responseObj]));
54
- }
55
-
56
- // Return raw iCalendar with proper headers
57
18
  ctx.status = 200;
58
19
  ctx.remove('DAV');
59
20
  ctx.set('Content-Type', 'text/calendar; charset=utf-8');
@@ -76,21 +37,6 @@ module.exports = function (options) {
76
37
 
77
38
  const ics = await options.data.buildICS(ctx, event, calendar);
78
39
 
79
- const accept = ctx.accepts(['text/xml', 'text/calendar']);
80
-
81
- if (accept === 'text/xml') {
82
- const responseObj = response(ctx.url, status[200], [
83
- {
84
- 'D:getetag': options.data.getETag(ctx, calendar)
85
- },
86
- {
87
- 'CAL:calendar-data': encodeXMLEntities(ics)
88
- }
89
- ]);
90
- return build(multistatus([responseObj]));
91
- }
92
-
93
- // Return raw iCalendar with proper headers
94
40
  ctx.status = 200;
95
41
  ctx.remove('DAV');
96
42
  ctx.set('Content-Type', 'text/calendar; charset=utf-8');