]> git.mxchange.org Git - friendica.git/commitdiff
Throw an error when the feed is invalid
authorMichael <heluecht@pirati.ca>
Tue, 3 May 2022 08:20:26 +0000 (08:20 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 3 May 2022 08:20:26 +0000 (08:20 +0000)
src/Module/Feed.php

index 8db92c275a7a067c78628b8f90ed335b9ac9e05a..9acde7bb30c61e8c2654650beca795f318a04672 100644 (file)
@@ -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);
        }
 }