From: Hypolite Petovan Date: Thu, 8 Dec 2022 03:28:09 +0000 (-0500) Subject: Ward against invalid name from receiver in ActivityPub::storeReceivers X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c70d657885351a780b222c784681104f7f1dc8c6;p=friendica.git Ward against invalid name from receiver in ActivityPub::storeReceivers - Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1338133783 --- diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 60a5c8d741..d098ddb691 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -1273,8 +1273,11 @@ class Processor foreach ($receivers[$element] as $receiver) { if ($receiver == ActivityPub::PUBLIC_COLLECTION) { $name = Receiver::PUBLIC_COLLECTION; + } elseif ($path = parse_url($receiver, PHP_URL_PATH)) { + $name = trim($path, '/'); } else { - $name = trim(parse_url($receiver, PHP_URL_PATH), '/'); + Logger::warning('Unable to coerce name from receiver', ['receiver' => $receiver]); + $name = ''; } $target = Tag::getTargetType($receiver);