From 5c659b130664f65bc8f1df7a6c38d897ea84dbf9 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 28 Jul 2024 19:02:13 +0200 Subject: [PATCH] Revert "[backend] Improve JSON-LD context size limiter" This reverts commit 9a8b7efcd67584d8ab1ee6d42bcc2152d0a01f98. --- .../src/remote/activitypub/misc/ld-signature.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/remote/activitypub/misc/ld-signature.ts b/packages/backend/src/remote/activitypub/misc/ld-signature.ts index c57e3ae47..b654e8976 100644 --- a/packages/backend/src/remote/activitypub/misc/ld-signature.ts +++ b/packages/backend/src/remote/activitypub/misc/ld-signature.ts @@ -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 {