Properly fix empty body on GET/HEAD for CardDav/CalDav
Related to 47f443c300
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
website:
|
website:
|
||||||
image: ghcr.io/bewcloud/bewcloud:v2.4.6
|
image: ghcr.io/bewcloud/bewcloud:v2.4.7
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:8000:8000
|
- 127.0.0.1:8000:8000
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ export const handler: Handler<Data, FreshContextState> = async (request, context
|
|||||||
const requestBodyText = await request.clone().text();
|
const requestBodyText = await request.clone().text();
|
||||||
|
|
||||||
// Remove the `/caldav/` prefix from the hrefs in the request
|
// Remove the `/caldav/` prefix from the hrefs in the request
|
||||||
let parsedRequestBodyText = requestBodyText.replaceAll('<href>/caldav/', `<href>/`).replaceAll(
|
let parsedRequestBodyText: string | undefined = requestBodyText.replaceAll('<href>/caldav/', `<href>/`).replaceAll(
|
||||||
':href>/caldav/',
|
':href>/caldav/',
|
||||||
`:href>/`,
|
`:href>/`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The spec doesn't allow a body for GET or HEAD requests (and Deno fails if you try)
|
// The spec doesn't allow a body for GET or HEAD requests (and Deno fails if you try)
|
||||||
if (request.method === 'GET' || request.method === 'HEAD') {
|
if (request.method === 'GET' || request.method === 'HEAD') {
|
||||||
parsedRequestBodyText = '';
|
parsedRequestBodyText = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`${calendarConfig.calDavUrl}/${path}`, {
|
const response = await fetch(`${calendarConfig.calDavUrl}/${path}`, {
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ export const handler: Handler<Data, FreshContextState> = async (request, context
|
|||||||
const requestBodyText = await request.clone().text();
|
const requestBodyText = await request.clone().text();
|
||||||
|
|
||||||
// Remove the `/carddav/` prefix from the hrefs in the request
|
// Remove the `/carddav/` prefix from the hrefs in the request
|
||||||
let parsedRequestBodyText = requestBodyText.replaceAll('<href>/carddav/', `<href>/`).replaceAll(
|
let parsedRequestBodyText: string | undefined = requestBodyText.replaceAll('<href>/carddav/', `<href>/`).replaceAll(
|
||||||
':href>/carddav/',
|
':href>/carddav/',
|
||||||
`:href>/`,
|
`:href>/`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The spec doesn't allow a body for GET or HEAD requests (and Deno fails if you try)
|
// The spec doesn't allow a body for GET or HEAD requests (and Deno fails if you try)
|
||||||
if (request.method === 'GET' || request.method === 'HEAD') {
|
if (request.method === 'GET' || request.method === 'HEAD') {
|
||||||
parsedRequestBodyText = '';
|
parsedRequestBodyText = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`${contactsConfig.cardDavUrl}/${path}`, {
|
const response = await fetch(`${contactsConfig.cardDavUrl}/${path}`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user