mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 11:50:33 +08:00
feat: fix webdav 逻辑
This commit is contained in:
@@ -42,7 +42,7 @@ async function handle(
|
||||
}
|
||||
|
||||
const endpointPath = params.path.join("/");
|
||||
const targetPath = `${endpoint}/${endpointPath}`;
|
||||
const targetPath = `${endpoint}${endpointPath}`;
|
||||
|
||||
// only allow MKCOL, GET, PUT
|
||||
if (req.method !== "MKCOL" && req.method !== "GET" && req.method !== "PUT") {
|
||||
@@ -96,7 +96,7 @@ async function handle(
|
||||
);
|
||||
}
|
||||
|
||||
const targetUrl = `${endpoint}/${endpointPath}`;
|
||||
const targetUrl = targetPath;
|
||||
|
||||
const method = req.method;
|
||||
const shouldNotHaveBody = ["get", "head"].includes(
|
||||
@@ -114,13 +114,22 @@ async function handle(
|
||||
duplex: "half",
|
||||
};
|
||||
|
||||
const fetchResult = await fetch(targetUrl, fetchOptions);
|
||||
|
||||
console.log("[Any Proxy]", targetUrl, {
|
||||
status: fetchResult.status,
|
||||
statusText: fetchResult.statusText,
|
||||
method: req.method,
|
||||
params: req.body,
|
||||
});
|
||||
|
||||
let fetchResult;
|
||||
|
||||
try {
|
||||
fetchResult = await fetch(targetUrl, fetchOptions);
|
||||
} finally {
|
||||
console.log("[Any Proxy]", targetUrl, {
|
||||
status: fetchResult?.status,
|
||||
statusText: fetchResult?.statusText,
|
||||
});
|
||||
}
|
||||
|
||||
return fetchResult;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user