Skip to content

Commit

Permalink
fix: fix webdav sync issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-bf committed Mar 13, 2024
1 parent 6aaf83f commit 99aa064
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/api/webdav/[...path]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ async function handle(
const fileName = `${folder}/backup.json`;

const requestUrl = new URL(req.url);
const endpoint = requestUrl.searchParams.get("endpoint");

const [protocol, ...subpath] = params.path;

const endpointPath = subpath.join("/");
let endpoint = requestUrl.searchParams.get("endpoint");
if (!endpoint?.endsWith("/")) {
endpoint += "/";
}
const endpointPath = params.path.join("/");

// only allow MKCOL, GET, PUT
if (req.method !== "MKCOL" && req.method !== "GET" && req.method !== "PUT") {
Expand Down Expand Up @@ -78,7 +78,7 @@ async function handle(
);
}

const targetUrl = `${protocol}://${endpoint + endpointPath}`;
const targetUrl = `${endpoint + endpointPath}`;

const method = req.method;
const shouldNotHaveBody = ["get", "head"].includes(
Expand Down

0 comments on commit 99aa064

Please sign in to comment.