Merge pull request #8599 from MrPetovan/task/8593-ensure-location-plaintext

Account for missing location value in ActivityPub\Receiver
This commit is contained in:
Michael Vogel 2020-05-07 16:29:03 +02:00 committed by GitHub
commit fbf846accb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1059,12 +1059,13 @@ class Receiver
$location = JsonLD::fetchElement($object, 'as:location', 'as:name', '@type', 'as:Place');
$location = JsonLD::fetchElement($location, 'location', '@value');
// 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.
$location = Markdown::convert($location);
$location = BBCode::convert($location);
$location = HTML::toPlaintext($location);
if ($location) {
// 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.
$location = Markdown::convert($location);
$location = BBCode::convert($location);
$location = HTML::toPlaintext($location);
}
$object_data['sc:identifier'] = JsonLD::fetchElement($object, 'sc:identifier', '@value');
$object_data['diaspora:guid'] = JsonLD::fetchElement($object, 'diaspora:guid', '@value');