From 23d5e03ba2a87880c1cb1509602098a57ff71a17 Mon Sep 17 00:00:00 2001 From: Julia Johannesen Date: Sun, 27 Apr 2025 00:50:49 -0400 Subject: [PATCH] Fix GHSA-7899-w6c4-vqc4 --- src/general.ts | 4 +++- src/utils/got.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/general.ts b/src/general.ts index 9d8d549..66d7423 100644 --- a/src/general.ts +++ b/src/general.ts @@ -132,6 +132,7 @@ async function getOEmbedPlayer($: cheerio.CheerioAPI, pageUrl: string): Promise< export type GeneralScrapingOptions = { lang?: string | null; userAgent?: string; + followRedirects?: boolean; responseTimeout?: number; operationTimeout?: number; contentLengthLimit?: number; @@ -147,6 +148,7 @@ export async function general(_url: URL | string, opts?: GeneralScrapingOptions) const res = await scpaping(url.href, { lang: lang || undefined, userAgent: opts?.userAgent, + followRedirects: opts?.followRedirects, responseTimeout: opts?.responseTimeout, operationTimeout: opts?.operationTimeout, contentLengthLimit: opts?.contentLengthLimit, @@ -251,7 +253,7 @@ export async function parseGeneral(_url: URL | string, res: Awaited; typeFilter?: RegExp; + followRedirects?: boolean; responseTimeout?: number; operationTimeout?: number; contentLengthLimit?: number; @@ -46,6 +47,7 @@ export function getGotOptions(url: string, opts?: GeneralScrapingOptions): Omit< 'accept-language': opts?.lang ?? undefined, }, typeFilter: /^(text\/html|application\/xhtml\+xml)/, + followRedirects: opts?.followRedirects, responseTimeout: opts?.responseTimeout, operationTimeout: opts?.operationTimeout, contentLengthLimit: opts?.contentLengthLimit,