]> git.mxchange.org Git - friendica.git/commitdiff
Ward against invalid name from receiver in ActivityPub::storeReceivers
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 8 Dec 2022 03:28:09 +0000 (22:28 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 10 Dec 2022 16:38:41 +0000 (11:38 -0500)
- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1338133783

src/Protocol/ActivityPub/Processor.php

index 60a5c8d74195716b4917ca75b5210216d7adbafc..d098ddb691343f957f9ea1f525807158995099cf 100644 (file)
@@ -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);