Merge pull request #9590 from MrPetovan/bug/fatal-errors
Avoid unmarking for archival an empty contact in Protocol\ActivityPub\Receiver
This commit is contained in:
commit
32f70abf9a
|
@ -99,13 +99,15 @@ class Receiver
|
||||||
$actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id');
|
$actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id');
|
||||||
|
|
||||||
$apcontact = APContact::getByURL($actor);
|
$apcontact = APContact::getByURL($actor);
|
||||||
if (!empty($apcontact) && ($apcontact['type'] == 'Application') && ($apcontact['nick'] == 'relay')) {
|
if (empty($apcontact)) {
|
||||||
|
Logger::notice('Unable to retrieve AP contact for actor', ['actor' => $actor]);
|
||||||
|
} elseif ($apcontact['type'] == 'Application' && $apcontact['nick'] == 'relay') {
|
||||||
self::processRelayPost($ldactivity, $actor);
|
self::processRelayPost($ldactivity, $actor);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
APContact::unmarkForArchival($apcontact);
|
||||||
}
|
}
|
||||||
|
|
||||||
APContact::unMarkForArchival($apcontact);
|
|
||||||
|
|
||||||
$http_signer = HTTPSignature::getSigner($body, $header);
|
$http_signer = HTTPSignature::getSigner($body, $header);
|
||||||
if (empty($http_signer)) {
|
if (empty($http_signer)) {
|
||||||
Logger::warning('Invalid HTTP signature, message will be discarded.');
|
Logger::warning('Invalid HTTP signature, message will be discarded.');
|
||||||
|
@ -235,7 +237,7 @@ class Receiver
|
||||||
|
|
||||||
$profile = APContact::getByURL($object_id);
|
$profile = APContact::getByURL($object_id);
|
||||||
if (!empty($profile['type'])) {
|
if (!empty($profile['type'])) {
|
||||||
APContact::unMarkForArchival($profile);
|
APContact::unmarkForArchival($profile);
|
||||||
return 'as:' . $profile['type'];
|
return 'as:' . $profile['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue