Skip to content

Commit f260f11

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents c3108b3 + b972a0d commit f260f11

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

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((allowedEndpoint) =>
28-
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
@@ -188,6 +188,7 @@ const anthropicModels = [
188188
"claude-3-sonnet-20240229",
189189
"claude-3-opus-20240229",
190190
"claude-3-haiku-20240307",
191+
"claude-3-5-sonnet-20240620",
191192
];
192193

193194
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)