Account for missing location value in ActivityPub\Receiver

This commit is contained in:
Hypolite Petovan 2020-05-07 09:17:16 -04:00
parent 64f1bc8a68
commit 8abaac6d79

View file

@ -1059,12 +1059,13 @@ class Receiver
$location = JsonLD::fetchElement($object, 'as:location', 'as:name', '@type', 'as:Place'); $location = JsonLD::fetchElement($object, 'as:location', 'as:name', '@type', 'as:Place');
$location = JsonLD::fetchElement($location, 'location', '@value'); $location = JsonLD::fetchElement($location, 'location', '@value');
if ($location) {
// Some AP software allow formatted text in post location, so we run all the text converters we have to boil // Some AP software allow formatted text in post location, so we run all the text converters we have to boil
// down to HTML and then finally format to plaintext. // down to HTML and then finally format to plaintext.
$location = Markdown::convert($location); $location = Markdown::convert($location);
$location = BBCode::convert($location); $location = BBCode::convert($location);
$location = HTML::toPlaintext($location); $location = HTML::toPlaintext($location);
}
$object_data['sc:identifier'] = JsonLD::fetchElement($object, 'sc:identifier', '@value'); $object_data['sc:identifier'] = JsonLD::fetchElement($object, 'sc:identifier', '@value');
$object_data['diaspora:guid'] = JsonLD::fetchElement($object, 'diaspora:guid', '@value'); $object_data['diaspora:guid'] = JsonLD::fetchElement($object, 'diaspora:guid', '@value');