Skip to content

Commit 1b898b1

Browse files
committed
2 parents 703bfb4 + b972a0d commit 1b898b1

4 files changed

Lines changed: 21 additions & 6 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Zhang Yifei
3+
Copyright (c) 2023-2024 Zhang Yifei
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

app/api/webdav/[...path]/route.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const mergedAllowedWebDavEndpoints = [
99
...config.allowedWebDevEndpoints,
1010
].filter((domain) => Boolean(domain.trim()));
1111

12+
const normalizeUrl = (url: string) => {
13+
try {
14+
return new URL(url);
15+
} catch (err) {
16+
return null;
17+
}
18+
};
19+
1220
async function handle(
1321
req: NextRequest,
1422
{ params }: { params: { path: string[] } },
@@ -24,9 +32,15 @@ async function handle(
2432

2533
// Validate the endpoint to prevent potential SSRF attacks
2634
if (
27-
!mergedAllowedWebDavEndpoints.some(
28-
(allowedEndpoint) => endpoint?.startsWith(allowedEndpoint),
29-
)
35+
!endpoint ||
36+
!mergedAllowedWebDavEndpoints.some((allowedEndpoint) => {
37+
const normalizedAllowedEndpoint = normalizeUrl(allowedEndpoint);
38+
const normalizedEndpoint = normalizeUrl(endpoint as string);
39+
40+
return normalizedEndpoint &&
41+
normalizedEndpoint.hostname === normalizedAllowedEndpoint?.hostname &&
42+
normalizedEndpoint.pathname.startsWith(normalizedAllowedEndpoint.pathname);
43+
})
3044
) {
3145
return NextResponse.json(
3246
{

app/constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ const anthropicModels = [
167167
"claude-3-sonnet-20240229",
168168
"claude-3-opus-20240229",
169169
"claude-3-haiku-20240307",
170+
"claude-3-5-sonnet-20240620",
170171
];
171172

172173
export const DEFAULT_MODELS = [

src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"package": {
1111
"productName": "NextChat",
12-
"version": "2.12.3"
12+
"version": "2.12.4"
1313
},
1414
"tauri": {
1515
"allowlist": {
@@ -112,4 +112,4 @@
112112
}
113113
]
114114
}
115-
}
115+
}

0 commit comments

Comments
 (0)