caldav-adapter 8.2.10 → 8.2.11

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.10",
4
+ "version": "8.2.11",
5
5
  "author": "Sanders DeNardi and Forward Email LLC",
6
6
  "contributors": [
7
7
  "Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",
@@ -0,0 +1,27 @@
1
+ const {
2
+ build,
3
+ multistatus,
4
+ response,
5
+ status,
6
+ href,
7
+ buildTag
8
+ } = require('../../common/x-build');
9
+
10
+ module.exports = function (_options) {
11
+ return async function (ctx) {
12
+ // GET requests to principals should return the current user principal
13
+ // This is what CalDAV clients expect when they follow redirects from root URL
14
+
15
+ const principalInfo = [
16
+ {
17
+ [buildTag('DAV:', 'current-user-principal')]: href(
18
+ ctx.state.principalUrl
19
+ )
20
+ }
21
+ ];
22
+
23
+ const resps = response(ctx.url, status[200], principalInfo);
24
+ const ms = multistatus([resps]);
25
+ return build(ms);
26
+ };
27
+ };
@@ -6,6 +6,7 @@ const {
6
6
  } = require('../../common/response');
7
7
  const winston = require('../../common/winston');
8
8
  const routePropfind = require('./propfind');
9
+ const routeGet = require('./get'); // New GET handler
9
10
  const routeMkCalendar = require('./mkcalendar');
10
11
  // const routeReport = require('./report');
11
12
 
@@ -13,7 +14,7 @@ module.exports = function (options) {
13
14
  const log = winston({ ...options, label: 'principal' });
14
15
  const methods = {
15
16
  propfind: routePropfind(options),
16
- get: routePropfind(options), // Handle GET same as PROPFIND for redirected requests
17
+ get: routeGet(options), // Use proper GET handler instead of reusing PROPFIND
17
18
  // report: reportReport(opts)
18
19
  //
19
20
  // TODO: proppatch