From af92f46a2d5911529235f3aaeb3c3f7227785066 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 25 Apr 2019 13:30:30 +0000 Subject: [PATCH] Workaround for systems who don't use a correct context in ActivityPub --- src/Util/JsonLD.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 9b0012fe38..bf4ecbe3e2 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -98,7 +98,12 @@ class JsonLD 'dc' => (object)['@id' => 'http://purl.org/dc/terms/', '@type' => '@id'], 'toot' => (object)['@id' => 'http://joinmastodon.org/ns#', '@type' => '@id']]; - // Workaround for Nextcloud Social + // Preparation for adding possibly missing content to the context + if (!empty($json['@context']) && is_string($json['@context'])) { + $json['@context'] = [$json['@context']]; + } + + // Workaround for servers with missing context // See issue https://github.com/nextcloud/social/issues/330 if (!empty($json['@context']) && is_array($json['@context'])) { $json['@context'][] = 'https://w3id.org/security/v1';