Throw exception when a few keys are missing from probe data array in Repository\DiasporaContact
- Address part of https://github.com/friendica/friendica/issues/11993#issuecomment-1338134893
This commit is contained in:
parent
d87585477c
commit
e78471c847
2 changed files with 36 additions and 8 deletions
|
@ -234,6 +234,18 @@ class DiasporaContact extends BaseRepository
|
|||
*/
|
||||
public function updateFromProbeArray(array $data): Entity\DiasporaContact
|
||||
{
|
||||
if (empty($data['url'])) {
|
||||
throw new \InvalidArgumentException('Missing url key in Diaspora probe data array');
|
||||
}
|
||||
|
||||
if (empty($data['guid'])) {
|
||||
throw new \InvalidArgumentException('Missing guid key in Diaspora probe data array');
|
||||
}
|
||||
|
||||
if (empty($data['pubkey'])) {
|
||||
throw new \InvalidArgumentException('Missing pubkey key in Diaspora probe data array');
|
||||
}
|
||||
|
||||
$uriId = ItemURI::insert(['uri' => $data['url'], 'guid' => $data['guid']]);
|
||||
|
||||
$contact = Contact::getByUriId($uriId, ['id', 'created']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue