From: Michael Date: Sat, 5 Nov 2022 22:32:56 +0000 (+0000) Subject: Improved url detection X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=db12814f3bf47d0d1b1640c617ac870c840c2c93;p=friendica.git Improved url detection --- diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php index 71f867d48b..71f6f82dab 100644 --- a/src/Module/Api/Mastodon/Accounts/Search.php +++ b/src/Module/Api/Mastodon/Accounts/Search.php @@ -28,6 +28,7 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Module\BaseApi; use Friendica\Object\Search\ContactResult; +use Friendica\Util\Network; /** * @see https://docs.joinmastodon.org/methods/accounts/ @@ -52,7 +53,7 @@ class Search extends BaseApi $accounts = []; if ($request['resolve']) { - if ((strrpos($request['q'], '@') > 0)) { + if ((strrpos($request['q'], '@') > 0) || Network::isValidHttpUrl($request['q'])) { $results = CoreSearch::getContactsFromProbe($request['q']); } diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 2acfb90efa..b21ff50f29 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -31,6 +31,7 @@ use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Module\BaseApi; use Friendica\Object\Search\ContactResult; +use Friendica\Util\Network; /** * @see https://docs.joinmastodon.org/methods/search/ @@ -84,7 +85,7 @@ class Search extends BaseApi $accounts = []; if ($resolve) { - if ((strrpos($q, '@') > 0)) { + if ((strrpos($q, '@') > 0) || Network::isValidHttpUrl($q)) { $results = CoreSearch::getContactsFromProbe($q); }