From e73eda01565db47486ec5f95f4b96496a9c5f81f Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 17 Nov 2021 08:16:33 +0100 Subject: [PATCH] Add feedback --- src/Module/Acctlink.php | 16 ++++++++-------- .../{ModuleTest.php => ModuleControllerTest.php} | 0 2 files changed, 8 insertions(+), 8 deletions(-) rename tests/src/App/{ModuleTest.php => ModuleControllerTest.php} (100%) diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 4093e3cd8..81b2c2391 100644 --- a/src/Module/Acctlink.php +++ b/src/Module/Acctlink.php @@ -34,15 +34,15 @@ class Acctlink extends BaseModule public function rawContent() { $addr = trim($_GET['addr'] ?? ''); - - if ($addr) { - $url = Contact::getByURL($addr)['url'] ?? ''; - if ($url) { - System::externalRedirect($url['url']); - exit(); - } + if (!$addr) { + throw new NotFoundException('Parameter "addr" is missing or empty'); } - throw new NotFoundException('Parameter "url" is missing'); + $contact = Contact::getByURL($addr, null, ['url']) ?? ''; + if (!$contact) { + throw new NotFoundException('Contact not found'); + } + + System::externalRedirect($contact['url']); } } diff --git a/tests/src/App/ModuleTest.php b/tests/src/App/ModuleControllerTest.php similarity index 100% rename from tests/src/App/ModuleTest.php rename to tests/src/App/ModuleControllerTest.php