From e6440471ae1a3bfce1b284daeea26ece9fb0af80 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 3 May 2022 08:20:26 +0000 Subject: [PATCH] Throw an error when the feed is invalid --- src/Module/Feed.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 8db92c275a..9acde7bb30 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -25,6 +25,7 @@ use Friendica\BaseModule; use Friendica\Core\System; use Friendica\DI; use Friendica\Protocol\Feed as ProtocolFeed; +use Friendica\Network\HTTPException; /** * Provides public Atom feeds @@ -42,7 +43,7 @@ use Friendica\Protocol\Feed as ProtocolFeed; */ class Feed extends BaseModule { - protected function content(array $request = []): string + protected function rawContent(array $request = []) { $last_update = $request['last_update'] ?? ''; $nocache = !empty($request['nocache']) && local_user(); @@ -66,6 +67,11 @@ class Feed extends BaseModule $type = 'posts'; } - System::httpExit(ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true), Response::TYPE_ATOM); + $feed = ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true); + if (empty($feed)) { + throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); + } + + System::httpExit($feed, Response::TYPE_ATOM); } }