From 647bf8c9539b88d4ca8190271eed482b5e25f1b0 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Mon, 14 Sep 2020 20:48:10 +0300 Subject: [PATCH] [ActivityPub] Fix use of ActivityPubPlugin::pull_remote_profile It does not throw but return null. --- plugins/ActivityPub/ActivityPubPlugin.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/ActivityPub/ActivityPubPlugin.php b/plugins/ActivityPub/ActivityPubPlugin.php index 37725c6951..1fee38f057 100644 --- a/plugins/ActivityPub/ActivityPubPlugin.php +++ b/plugins/ActivityPub/ActivityPubPlugin.php @@ -752,10 +752,10 @@ class ActivityPubPlugin extends Plugin */ public function onStartCommandGetProfile($command, $arg, &$profile) { - try { - $aprofile = $this->pull_remote_profile($arg); + $aprofile = self::pull_remote_profile($arg); + if ($aprofile instanceof Activitypub_profile) { $profile = $aprofile->local_profile(); - } catch (Exception $e) { + } else { // No remote ActivityPub profile found return true; } @@ -795,12 +795,10 @@ class ActivityPubPlugin extends Plugin */ public function onRemoteFollowPullProfile(string $uri, ?Profile &$profile): bool { - try { - $aprofile = $this->pull_remote_profile($uri); - if ($aprofile instanceof Activitypub_profile) { - $profile = $aprofile->local_profile(); - } - } catch (Exception $e) { + $aprofile = self::pull_remote_profile($uri); + if ($aprofile instanceof Activitypub_profile) { + $profile = $aprofile->local_profile(); + } else { // No remote ActivityPub profile found return true; }