]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/APContact.php
Changed double-quotes to single
[friendica.git] / src / Model / APContact.php
index 5c1d962a844a898862542aa4f859c411e3d05853..baa364e940636a4e1d39ea7e40cadd5fed0e7bdb 100644 (file)
@@ -116,6 +116,7 @@ class APContact
         * @return array profile array
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
+        * @todo Rewrite parameter $update to avoid true|false|null (boolean is binary, null adds a third case)
         */
        public static function getByURL(string $url, $update = null): array
        {
@@ -164,6 +165,8 @@ class APContact
                                return $fetched_contact;
                        }
                        $url = $apcontact['url'];
+               } elseif (empty(parse_url($url, PHP_URL_PATH))) {
+                       $apcontact['baseurl'] = $url;
                }
 
                // Detect multiple fast repeating request to the same address
@@ -465,7 +468,7 @@ class APContact
                }
 
                // Limit the length on incoming fields
-               $apcontact = DBStructure::getFieldsForTable('apcontact', $apcontact);
+               $apcontact = DI::dbaDefinition()->truncateFieldsForTable('apcontact', $apcontact);
 
                if (DBA::exists('apcontact', ['url' => $apcontact['url']])) {
                        DBA::update('apcontact', $apcontact, ['url' => $apcontact['url']]);