From 14e1c9677527118c73e999a221c006dd698a2b79 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 10 Sep 2024 10:26:05 +0000 Subject: [PATCH] Bluesky: Fix for the handling of invalid profiles --- bluesky/bluesky.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bluesky/bluesky.php b/bluesky/bluesky.php index 9145fc32..181e8d2d 100644 --- a/bluesky/bluesky.php +++ b/bluesky/bluesky.php @@ -1765,9 +1765,16 @@ function bluesky_get_did_by_profile(string $url): string return ''; } $profile = $curlResult->getBodyString(); + if (empty($profile)) { + return ''; + } $doc = new DOMDocument(); - @$doc->loadHTML($profile); + try { + @$doc->loadHTML($profile); + } catch (\Throwable $th) { + return ''; + } $xpath = new DOMXPath($doc); $list = $xpath->query('//p[@id]'); foreach ($list as $node) {