caldav-adapter 9.3.11 → 9.3.12

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.
Files changed (2) hide show
  1. package/index.js +14 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -126,20 +126,31 @@ module.exports = function (options) {
126
126
  const fillRoutes = function (ctx) {
127
127
  ctx.state.principalRootUrl = principalRoute;
128
128
  if (ctx.state.params.principalId) {
129
+ // Encode @ as %40 in principalId for URL construction.
130
+ // iOS/macOS URL parser treats bare @ in path segments as a userinfo
131
+ // separator (RFC 3986 §3.2.1), which corrupts the request URL and
132
+ // causes events to silently not appear in Apple Calendar.
133
+ // All URLs returned by the server (calendar-home-set, principal-URL,
134
+ // schedule-inbox-URL, event hrefs, etc.) must use %40 so that Apple
135
+ // clients send subsequent requests with the encoded form.
136
+ const encodedPrincipalId = ctx.state.params.principalId.replaceAll(
137
+ '@',
138
+ '%40'
139
+ );
129
140
  ctx.state.calendarHomeUrl = path.join(
130
141
  calendarRoute,
131
- ctx.state.params.principalId,
142
+ encodedPrincipalId,
132
143
  '/'
133
144
  );
134
145
  ctx.state.principalUrl = path.join(
135
146
  principalRoute,
136
- ctx.state.params.principalId,
147
+ encodedPrincipalId,
137
148
  '/'
138
149
  );
139
150
  if (ctx.state.params.calendarId) {
140
151
  ctx.state.calendarUrl = path.join(
141
152
  calendarRoute,
142
- ctx.state.params.principalId,
153
+ encodedPrincipalId,
143
154
  ctx.state.params.calendarId,
144
155
  '/'
145
156
  );
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.11",
4
+ "version": "9.3.12",
5
5
  "author": "Sanders DeNardi and Forward Email LLC",
6
6
  "contributors": [
7
7
  "Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",