mirror of
https://github.com/friendica/friendica
synced 2025-04-26 07:50:15 +00:00
Add Exception for empty User::getOwnerDataById(0 return case in Protocol\ActivityPub\Transmitter::getProfile()
- Address https://github.com/friendica/friendica/issues/10473#issuecomment-882781552 - Add try-catch blocks to all references of Protocol\ActivityPub\Transmitter::getProfile()
This commit is contained in:
parent
71a0c52dc3
commit
dfb043ce60
5 changed files with 53 additions and 26 deletions
|
@ -52,12 +52,13 @@ class Profile extends BaseProfile
|
|||
if (ActivityPub::isRequest()) {
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]);
|
||||
if (DBA::isResult($user)) {
|
||||
// The function returns an empty array when the account is removed, expired or blocked
|
||||
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
||||
if (!empty($data)) {
|
||||
try {
|
||||
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
} catch (HTTPException\NotFoundException $e) {
|
||||
System::jsonError(404, ['error' => 'Record not found']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue