Skip to content

Commit a129a8c

Browse files
committed
Revert "Block redirects explicitly in fetch-url API route"
This reverts commit fa469f9.
1 parent fa469f9 commit a129a8c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/routes/api/fetch-url/+server.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,12 @@ export async function GET({ url, fetch }) {
4848

4949
const response = await fetch(targetUrl, {
5050
signal: controller.signal,
51-
redirect: "manual",
51+
redirect: "error", // Block all redirects
5252
headers: {
5353
"User-Agent": "HuggingChat-Attachment-Fetcher/1.0",
5454
},
5555
}).finally(() => clearTimeout(timeoutId));
5656

57-
// Explicitly block redirects
58-
if (response.status >= 300 && response.status < 400) {
59-
throw error(400, "Redirects are not allowed");
60-
}
61-
6257
if (!response.ok) {
6358
throw error(response.status, `Failed to fetch: ${response.statusText}`);
6459
}

0 commit comments

Comments
 (0)