Fix GHSA-7899-w6c4-vqc4

This commit is contained in:
Julia Johannesen 2025-04-27 00:50:49 -04:00
parent 1b93243ff9
commit 23d5e03ba2
No known key found for this signature in database
GPG Key ID: 4A1377AF3E7FBC46
2 changed files with 5 additions and 1 deletions

View File

@ -132,6 +132,7 @@ async function getOEmbedPlayer($: cheerio.CheerioAPI, pageUrl: string): Promise<
export type GeneralScrapingOptions = { export type GeneralScrapingOptions = {
lang?: string | null; lang?: string | null;
userAgent?: string; userAgent?: string;
followRedirects?: boolean;
responseTimeout?: number; responseTimeout?: number;
operationTimeout?: number; operationTimeout?: number;
contentLengthLimit?: number; contentLengthLimit?: number;
@ -147,6 +148,7 @@ export async function general(_url: URL | string, opts?: GeneralScrapingOptions)
const res = await scpaping(url.href, { const res = await scpaping(url.href, {
lang: lang || undefined, lang: lang || undefined,
userAgent: opts?.userAgent, userAgent: opts?.userAgent,
followRedirects: opts?.followRedirects,
responseTimeout: opts?.responseTimeout, responseTimeout: opts?.responseTimeout,
operationTimeout: opts?.operationTimeout, operationTimeout: opts?.operationTimeout,
contentLengthLimit: opts?.contentLengthLimit, contentLengthLimit: opts?.contentLengthLimit,

View File

@ -24,6 +24,7 @@ export type GotOptions = {
body?: string; body?: string;
headers: Record<string, string | undefined>; headers: Record<string, string | undefined>;
typeFilter?: RegExp; typeFilter?: RegExp;
followRedirects?: boolean;
responseTimeout?: number; responseTimeout?: number;
operationTimeout?: number; operationTimeout?: number;
contentLengthLimit?: number; contentLengthLimit?: number;
@ -46,6 +47,7 @@ export function getGotOptions(url: string, opts?: GeneralScrapingOptions): Omit<
'accept-language': opts?.lang ?? undefined, 'accept-language': opts?.lang ?? undefined,
}, },
typeFilter: /^(text\/html|application\/xhtml\+xml)/, typeFilter: /^(text\/html|application\/xhtml\+xml)/,
followRedirects: opts?.followRedirects,
responseTimeout: opts?.responseTimeout, responseTimeout: opts?.responseTimeout,
operationTimeout: opts?.operationTimeout, operationTimeout: opts?.operationTimeout,
contentLengthLimit: opts?.contentLengthLimit, contentLengthLimit: opts?.contentLengthLimit,