]> git.mxchange.org Git - friendica.git/commitdiff
Support for empty nick names
authorMichael <heluecht@pirati.ca>
Wed, 24 Jul 2019 19:30:36 +0000 (19:30 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 24 Jul 2019 19:30:36 +0000 (19:30 +0000)
src/Model/APContact.php

index 82afc0769622959c068d320d293cd0f48808d3e2..e7191d32e8ad34b569ad6c88309f0c5ccee3efd5 100644 (file)
@@ -153,7 +153,7 @@ class APContact extends BaseObject
                        self::unarchiveInbox($apcontact['sharedinbox'], true);
                }
 
-               $apcontact['nick'] = JsonLD::fetchElement($compacted, 'as:preferredUsername', '@value');
+               $apcontact['nick'] = JsonLD::fetchElement($compacted, 'as:preferredUsername', '@value') ?? '';
                $apcontact['name'] = JsonLD::fetchElement($compacted, 'as:name', '@value');
 
                if (empty($apcontact['name'])) {
@@ -185,7 +185,12 @@ class APContact extends BaseObject
                $parts = parse_url($apcontact['url']);
                unset($parts['scheme']);
                unset($parts['path']);
-               $apcontact['addr'] = $apcontact['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts));
+
+               if (!empty($apcontact['nick'])) {
+                       $apcontact['addr'] = $apcontact['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts));
+               } else {
+                       $apcontact['addr'] = '';
+               }
 
                if (!empty($compacted['w3id:publicKey'])) {
                        $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value'));