Update AP helpers

This commit is contained in:
Daniel Supernault 2020-05-21 11:52:18 -06:00
parent 1cbf8dcb38
commit 18f32e7bcf
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -285,7 +285,7 @@ class Helpers {
} }
} }
if(!self::validateUrl($activity['object']['id']) || if(!self::validateUrl($res['id']) ||
!self::validateUrl($activity['object']['attributedTo']) !self::validateUrl($activity['object']['attributedTo'])
) { ) {
return; return;
@ -400,7 +400,10 @@ class Helpers {
return; return;
} }
$domain = parse_url($res['id'], PHP_URL_HOST); $domain = parse_url($res['id'], PHP_URL_HOST);
$username = (string) Purify::clean($res['preferredUsername']); if(!isset($res['preferredUsername']) && !isset($res['nickname'])) {
return;
}
$username = (string) Purify::clean($res['preferredUsername'] ?? $res['nickname']);
if(empty($username)) { if(empty($username)) {
return; return;
} }