From 044c738989af1322cbdaf46d8f62ece170c1a37b Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 14 Mar 2023 20:45:04 -0100 Subject: [PATCH] catch missing actor Signed-off-by: Maxence Lange --- lib/Service/CacheActorService.php | 2 ++ lib/WellKnown/WebfingerHandler.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Service/CacheActorService.php b/lib/Service/CacheActorService.php index 35314163..b8635f97 100644 --- a/lib/Service/CacheActorService.php +++ b/lib/Service/CacheActorService.php @@ -34,6 +34,7 @@ use Exception; use OCA\Social\AP; use OCA\Social\Db\ActorsRequest; use OCA\Social\Db\CacheActorsRequest; +use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\CacheActorDoesNotExistException; use OCA\Social\Exceptions\InvalidOriginException; use OCA\Social\Exceptions\InvalidResourceException; @@ -177,6 +178,7 @@ class CacheActorService { * @return Person * @throws CacheActorDoesNotExistException * @throws SocialAppConfigException + * @throws ActorDoesNotExistException */ public function getFromLocalAccount(string $account): Person { $instance = ''; diff --git a/lib/WellKnown/WebfingerHandler.php b/lib/WellKnown/WebfingerHandler.php index ec4a1004..a6a11ed7 100644 --- a/lib/WellKnown/WebfingerHandler.php +++ b/lib/WellKnown/WebfingerHandler.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCA\Social\WellKnown; use OCA\Social\Db\CacheActorsRequest; +use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\CacheActorDoesNotExistException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\UnauthorizedFediverseException; @@ -109,7 +110,7 @@ class WebfingerHandler implements IHandler { $actor = null; try { $actor = $this->cacheActorService->getFromLocalAccount($subject); - } catch (SocialAppConfigException $e) { + } catch (ActorDoesNotExistException | SocialAppConfigException $e) { return null; } catch (CacheActorDoesNotExistException $e) { }