Merge pull request #8734 from MrPetovan/bug/8732-noscrape-notice

Exit with an error if profile info isn't available in Module\NoScrape
This commit is contained in:
Michael Vogel 2020-06-06 09:31:31 +02:00 committed by GitHub
commit 3eb3fe8e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,14 +46,17 @@ class NoScrape extends BaseModule
$which = $parameters['nick']; $which = $parameters['nick'];
} elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') { } elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login) // view infos about a known profile (needs a login)
$which = $a->user['nickname']; $which = $a->user['nickname'];
} else { } else {
System::jsonError(403, 'Authentication required'); System::jsonError(403, 'Authentication required');
exit();
} }
Profile::load($a, $which); Profile::load($a, $which);
if (empty($a->profile['uid'])) {
System::jsonError(404, 'Profile not found');
}
$json_info = [ $json_info = [
'addr' => $a->profile['addr'], 'addr' => $a->profile['addr'],
'nick' => $which, 'nick' => $which,