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 fa469f9 commit a129a8cCopy full SHA for a129a8c
src/routes/api/fetch-url/+server.ts
@@ -48,17 +48,12 @@ export async function GET({ url, fetch }) {
48
49
const response = await fetch(targetUrl, {
50
signal: controller.signal,
51
- redirect: "manual",
+ redirect: "error", // Block all redirects
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