Revert "[backend] Improve JSON-LD context size limiter"

This reverts commit 9a8b7efcd6.
This commit is contained in:
Laura Hausmann 2024-07-28 19:02:13 +02:00
parent e9f776c7b2
commit 5c659b1306
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -122,12 +122,11 @@ export class LdSignature {
}
private async fetchDocument(url: string) {
const ctrl = new AbortController();
return await fetch(url, {
const json = await fetch(url, {
headers: {
Accept: "application/ld+json, application/json",
},
signal: ctrl.signal,
size: 1024 * 1024, // 1MiB
// TODO
//timeout: this.loderTimeout,
agent: (u) => (u.protocol === "http:" ? httpAgent : httpsAgent),
@ -135,12 +134,11 @@ export class LdSignature {
if (!res.ok) {
throw new Error(`${res.status} ${res.statusText}`);
} else {
if (res.size < 1024 * 1024) // 1MiB
return res.json();
ctrl.abort();
throw new Error('Size exceeded 1MiB');
return res.json();
}
});
return json;
}
public sha256(data: string): string {