From 3189f122067dc47d6de93c3185aca66d7df95e1a Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Fri, 15 Sep 2023 16:40:07 +0000 Subject: [PATCH] fix(fediverse): update post controller namespace in routes --- app/Config/Routes.php | 2 +- modules/Fediverse/Controllers/PostController.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 9ed603dc..ef5b7db2 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -231,7 +231,7 @@ $routes->group('@(:podcastHandle)', static function ($routes): void { 'controller-method' => 'PostController::index/$2', ], 'application/ld+json; profile="https://www.w3.org/ns/activitystreams' => [ - 'namespace' => 'Modules/Fediverse/Controllers', + 'namespace' => 'Modules\Fediverse\Controllers', 'controller-method' => 'PostController::index\$2', ], ], diff --git a/modules/Fediverse/Controllers/PostController.php b/modules/Fediverse/Controllers/PostController.php index a1348642..2a7069b3 100644 --- a/modules/Fediverse/Controllers/PostController.php +++ b/modules/Fediverse/Controllers/PostController.php @@ -50,6 +50,10 @@ class PostController extends Controller public function _remap(string $method, string ...$params): mixed { + if (count($params) === 0) { + throw PageNotFoundException::forPageNotFound(); + } + if (! ($post = model('PostModel', false)->getPostById($params[0])) instanceof Post) { throw PageNotFoundException::forPageNotFound(); }