Loading packages/fedify/src/runtime/docloader.ts +5 −1 Original line number Diff line number Diff line Loading @@ -330,6 +330,9 @@ export function getDocumentLoader( url: string, _options?: DocumentLoaderOptions, ): Promise<RemoteDocument> { if (_options?.signal?.aborted) { throw new DOMException("Aborted", "AbortError"); } if (!skipPreloadedContexts && url in preloadedContexts) { logger.debug("Using preloaded context: {url}.", { url }); return { Loading @@ -355,13 +358,14 @@ export function getDocumentLoader( // to work around it we specify `redirect: "manual"` here too: // https://github.com/oven-sh/bun/issues/10754 redirect: "manual", signal: _options?.signal, }); // Follow redirects manually to get the final URL: if ( response.status >= 300 && response.status < 400 && response.headers.has("Location") ) { return load(response.headers.get("Location")!); return load(response.headers.get("Location")!, _options); } return getRemoteDocument(url, response, load); } Loading packages/fedify/src/vocab/lookup.ts +6 −2 Original line number Diff line number Diff line Loading @@ -139,7 +139,9 @@ async function lookupObjectInternal( let document: unknown | null = null; if (identifier.protocol === "http:" || identifier.protocol === "https:") { try { const remoteDoc = await documentLoader(identifier.href); const remoteDoc = await documentLoader(identifier.href, { signal: options.signal, }); document = remoteDoc.document; } catch (error) { logger.debug("Failed to fetch remote document:\n{error}", { error }); Loading @@ -162,7 +164,9 @@ async function lookupObjectInternal( ) || l.rel !== "self" ) continue; try { const remoteDoc = await documentLoader(l.href); const remoteDoc = await documentLoader(l.href, { signal: options.signal, }); document = remoteDoc.document; break; } catch (error) { Loading Loading
packages/fedify/src/runtime/docloader.ts +5 −1 Original line number Diff line number Diff line Loading @@ -330,6 +330,9 @@ export function getDocumentLoader( url: string, _options?: DocumentLoaderOptions, ): Promise<RemoteDocument> { if (_options?.signal?.aborted) { throw new DOMException("Aborted", "AbortError"); } if (!skipPreloadedContexts && url in preloadedContexts) { logger.debug("Using preloaded context: {url}.", { url }); return { Loading @@ -355,13 +358,14 @@ export function getDocumentLoader( // to work around it we specify `redirect: "manual"` here too: // https://github.com/oven-sh/bun/issues/10754 redirect: "manual", signal: _options?.signal, }); // Follow redirects manually to get the final URL: if ( response.status >= 300 && response.status < 400 && response.headers.has("Location") ) { return load(response.headers.get("Location")!); return load(response.headers.get("Location")!, _options); } return getRemoteDocument(url, response, load); } Loading
packages/fedify/src/vocab/lookup.ts +6 −2 Original line number Diff line number Diff line Loading @@ -139,7 +139,9 @@ async function lookupObjectInternal( let document: unknown | null = null; if (identifier.protocol === "http:" || identifier.protocol === "https:") { try { const remoteDoc = await documentLoader(identifier.href); const remoteDoc = await documentLoader(identifier.href, { signal: options.signal, }); document = remoteDoc.document; } catch (error) { logger.debug("Failed to fetch remote document:\n{error}", { error }); Loading @@ -162,7 +164,9 @@ async function lookupObjectInternal( ) || l.rel !== "self" ) continue; try { const remoteDoc = await documentLoader(l.href); const remoteDoc = await documentLoader(l.href, { signal: options.signal, }); document = remoteDoc.document; break; } catch (error) { Loading