From 818ea3e33eda7df638231474f45f28218b70f9e7 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 12 Nov 2024 10:19:28 +0000 Subject: [PATCH] Avoid useless "warning" logging --- src/Model/Contact.php | 2 +- src/Protocol/ActivityPub/Processor.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index a9ef2276ab..4f449a1fa3 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -2301,7 +2301,7 @@ class Contact return; } - if (!Network::isValidHttpUrl($avatar)) { + if (!empty($avatar) && !Network::isValidHttpUrl($avatar)) { Logger::warning('Invalid avatar', ['cid' => $cid, 'avatar' => $avatar]); $avatar = ''; } diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 930c31a0d3..21be0f6379 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -877,10 +877,10 @@ class Processor { if (!empty($activity['mediatype']) && ($activity['mediatype'] == 'text/markdown')) { $item['title'] = strip_tags($activity['name'] ?? ''); - $content = Markdown::toBBCode($activity['content']); + $content = Markdown::toBBCode($activity['content'] ?? ''); } elseif (!empty($activity['mediatype']) && ($activity['mediatype'] == 'text/bbcode')) { - $item['title'] = $activity['name']; - $content = $activity['content']; + $item['title'] = $activity['name'] ?? ''; + $content = $activity['content'] ?? ''; } else { // By default assume "text/html" $item['title'] = HTML::toBBCode($activity['name'] ?? '');