Bluesky: Fix for the handling of invalid profiles

pull/1553/head
Michael 2024-09-10 10:26:05 +00:00
parent 7a7dbb579d
commit 14e1c96775
1 changed files with 8 additions and 1 deletions

View File

@ -1765,9 +1765,16 @@ function bluesky_get_did_by_profile(string $url): string
return '';
}
$profile = $curlResult->getBodyString();
if (empty($profile)) {
return '';
}
$doc = new DOMDocument();
try {
@$doc->loadHTML($profile);
} catch (\Throwable $th) {
return '';
}
$xpath = new DOMXPath($doc);
$list = $xpath->query('//p[@id]');
foreach ($list as $node) {