mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-06-04 20:00:19 +09:00
fix: #314
This commit is contained in:
parent
40b673054b
commit
4f93704300
@ -6,7 +6,7 @@ const config = getServerSideConfig();
|
|||||||
|
|
||||||
const mergedAllowedWebDavEndpoints = [
|
const mergedAllowedWebDavEndpoints = [
|
||||||
...internalAllowedWebDavEndpoints,
|
...internalAllowedWebDavEndpoints,
|
||||||
...config.allowedWebDevEndpoints,
|
...config.allowedWebDavEndpoints,
|
||||||
].filter((domain) => Boolean(domain.trim()));
|
].filter((domain) => Boolean(domain.trim()));
|
||||||
|
|
||||||
const normalizeUrl = (url: string) => {
|
const normalizeUrl = (url: string) => {
|
||||||
@ -37,9 +37,13 @@ async function handle(
|
|||||||
const normalizedAllowedEndpoint = normalizeUrl(allowedEndpoint);
|
const normalizedAllowedEndpoint = normalizeUrl(allowedEndpoint);
|
||||||
const normalizedEndpoint = normalizeUrl(endpoint as string);
|
const normalizedEndpoint = normalizeUrl(endpoint as string);
|
||||||
|
|
||||||
return normalizedEndpoint &&
|
return (
|
||||||
|
normalizedEndpoint &&
|
||||||
normalizedEndpoint.hostname === normalizedAllowedEndpoint?.hostname &&
|
normalizedEndpoint.hostname === normalizedAllowedEndpoint?.hostname &&
|
||||||
normalizedEndpoint.pathname.startsWith(normalizedAllowedEndpoint.pathname);
|
normalizedEndpoint.pathname.startsWith(
|
||||||
|
normalizedAllowedEndpoint.pathname,
|
||||||
|
)
|
||||||
|
);
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
|
Loading…
Reference in New Issue
Block a user