From 7559f16f4f67cdf24159636c323fe12f53f40601 Mon Sep 17 00:00:00 2001 From: Alain St-Denis Date: Wed, 26 Jul 2023 12:57:47 -0400 Subject: [PATCH] Remove references to http://schema.org from inbound AP contexts. --- federation/entities/activitypub/ldcontext.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/federation/entities/activitypub/ldcontext.py b/federation/entities/activitypub/ldcontext.py index 8fdafc2..414d60a 100644 --- a/federation/entities/activitypub/ldcontext.py +++ b/federation/entities/activitypub/ldcontext.py @@ -113,12 +113,13 @@ class LdContextManager: if 'python-federation"' in s: ctx = json.loads(s.replace('python-federation', 'python-federation#', 1)) - # some platforms have http://joinmastodon.com/ns in @context. This - # is not a json-ld document. - try: - ctx.pop(ctx.index('http://joinmastodon.org/ns')) - except ValueError: - pass + # Some platforms have reference invalid json-ld document in @context. + # Remove those. + for url in ['http://joinmastodon.org/ns', 'http://schema.org']: + try: + ctx.pop(ctx.index(url)) + except ValueError: + pass # remove @language in context since this directive is not # processed by calamus. Pleroma adds a useless @language: 'und'