rtrm HF Staff commited on
Commit
d7f6ac1
·
unverified ·
1 Parent(s): 3ac3ba4

fix: allow fetch redirect

Browse files
src/routes/api/fetch-url/+server.ts CHANGED
@@ -48,10 +48,9 @@ export async function GET({ url, fetch }) {
48
  const controller = new AbortController();
49
  const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT);
50
 
51
- logger.debug("Fetching url: " + targetUrl);
52
  const response = await fetch(targetUrl, {
53
- signal: controller.signal,
54
- redirect: "error", // Block all redirects
55
  headers: {
56
  "User-Agent": "HuggingChat-Attachment-Fetcher/1.0",
57
  },
 
48
  const controller = new AbortController();
49
  const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT);
50
 
51
+ logger.debug({ targetUrl }, "Fetching url");
52
  const response = await fetch(targetUrl, {
53
+ signal: controller.signal, // Block all redirects
 
54
  headers: {
55
  "User-Agent": "HuggingChat-Attachment-Fetcher/1.0",
56
  },