Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add max depth for fix compacted

Chocobozzzf523d23ce239
diff --git a/server/core/helpers/peertube-jsonld.ts b/server/core/helpers/peertube-jsonld.ts
index f802377ac7..b09a3a9842 100644
--- a/server/core/helpers/peertube-jsonld.ts
+++ b/server/core/helpers/peertube-jsonld.ts
@@ -47,7 +47,8 @@ export async function compactJSONLDAndCheckRSA2017Signature (fromActor: MActor,
return verify.verify(fromActor.publicKey, req.body.signature.signatureValue, 'base64')
}
-function fixCompacted (original: any, compacted: any) {
+function fixCompacted (original: any, compacted: any, depth = 1) {
+ if (depth > 20) return
if (!original || !compacted) return
for (const [ k, v ] of Object.entries(original)) {
@@ -74,7 +75,7 @@ function fixCompacted (original: any, compacted: any) {
}
if (typeof v === 'object') {
- fixCompacted(original[k], compacted[k])
+ fixCompacted(original[k], compacted[k], depth += 1)
}
}
}