From 18f32e7bcf6fec6b846f38e739ced5e3fd645bd3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 21 May 2020 11:52:18 -0600 Subject: [PATCH] Update AP helpers --- app/Util/ActivityPub/Helpers.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index 034c7bbf7..b748598b3 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -285,7 +285,7 @@ class Helpers { } } - if(!self::validateUrl($activity['object']['id']) || + if(!self::validateUrl($res['id']) || !self::validateUrl($activity['object']['attributedTo']) ) { return; @@ -400,7 +400,10 @@ class Helpers { return; } $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)) { return; }