]> git.mxchange.org Git - friendica-addons.git/commitdiff
Bluesky: Fix for the handling of invalid profiles
authorMichael <heluecht@pirati.ca>
Tue, 10 Sep 2024 10:26:05 +0000 (10:26 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 10 Sep 2024 10:26:05 +0000 (10:26 +0000)
bluesky/bluesky.php

index 9145fc32c07f0a65b10fafc36e27ce1eb26034bd..181e8d2db2f24cda539acc65ab32256920a9ec0b 100644 (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();
-       @$doc->loadHTML($profile);
+       try {
+               @$doc->loadHTML($profile);
+       } catch (\Throwable $th) {
+               return '';
+       }
        $xpath = new DOMXPath($doc);
        $list = $xpath->query('//p[@id]');
        foreach ($list as $node) {