caldav-adapter 9.3.1 → 9.3.3
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": "9.3.
|
|
4
|
+
"version": "9.3.3",
|
|
5
5
|
"author": "Sanders DeNardi and Forward Email LLC",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",
|
|
@@ -17,12 +17,13 @@ module.exports = function (options) {
|
|
|
17
17
|
ctx.request.xml
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
const filters = veventFilters
|
|
21
|
-
const componentType =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const filters = veventFilters.length > 0 ? veventFilters : vtodoFilters;
|
|
21
|
+
const componentType =
|
|
22
|
+
veventFilters.length > 0
|
|
23
|
+
? 'VEVENT'
|
|
24
|
+
: vtodoFilters.length > 0
|
|
25
|
+
? 'VTODO'
|
|
26
|
+
: null;
|
|
26
27
|
const { children } = xml.getWithChildren(
|
|
27
28
|
'/CAL:calendar-query/D:prop',
|
|
28
29
|
ctx.request.xml
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { preconditionFail } = require('../../../common/x-build');
|
|
2
2
|
const { setMissingMethod } = require('../../../common/response');
|
|
3
3
|
const winston = require('../../../common/winston');
|
|
4
4
|
|
|
@@ -23,11 +23,19 @@ module.exports = function (options) {
|
|
|
23
23
|
typeof ctx.request.body !== 'string'
|
|
24
24
|
) {
|
|
25
25
|
log.warn('incoming ICS file not present in body');
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
ctx.
|
|
26
|
+
//
|
|
27
|
+
// RFC 4791 Section 5.3.2: PUT requires Content-Type: text/calendar
|
|
28
|
+
// Return 415 Unsupported Media Type instead of misleading 404
|
|
29
|
+
//
|
|
30
|
+
ctx.status = 415;
|
|
31
|
+
ctx.set('Content-Type', 'application/xml; charset="utf-8"');
|
|
32
|
+
ctx.body = [
|
|
33
|
+
'<?xml version="1.0" encoding="utf-8"?>',
|
|
34
|
+
'<D:error xmlns:D="DAV:">',
|
|
35
|
+
' <D:supported-calendar-data/>',
|
|
36
|
+
' <D:description>PUT requires Content-Type: text/calendar</D:description>',
|
|
37
|
+
'</D:error>'
|
|
38
|
+
].join('\n');
|
|
31
39
|
return;
|
|
32
40
|
}
|
|
33
41
|
|
|
@@ -6,7 +6,8 @@ const xml = require('../../common/xml');
|
|
|
6
6
|
function parseSupportedComponents(node) {
|
|
7
7
|
const comps = [];
|
|
8
8
|
if (!node.childNodes) return comps;
|
|
9
|
-
for (
|
|
9
|
+
for (let i = 0; i < node.childNodes.length; i++) {
|
|
10
|
+
const comp = node.childNodes[i];
|
|
10
11
|
if (comp.localName !== 'comp') continue;
|
|
11
12
|
const name = comp.getAttribute ? comp.getAttribute('name') : null;
|
|
12
13
|
if (name) comps.push(name.toUpperCase());
|