We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce84efe commit fa469f9Copy full SHA for fa469f9
src/routes/api/fetch-url/+server.ts
@@ -48,12 +48,17 @@ export async function GET({ url, fetch }) {
48
49
const response = await fetch(targetUrl, {
50
signal: controller.signal,
51
- redirect: "error", // Block all redirects
+ redirect: "manual",
52
headers: {
53
"User-Agent": "HuggingChat-Attachment-Fetcher/1.0",
54
},
55
}).finally(() => clearTimeout(timeoutId));
56
57
+ // Explicitly block redirects
58
+ if (response.status >= 300 && response.status < 400) {
59
+ throw error(400, "Redirects are not allowed");
60
+ }
61
+
62
if (!response.ok) {
63
throw error(response.status, `Failed to fetch: ${response.statusText}`);
64
}
0 commit comments