From db12814f3bf47d0d1b1640c617ac870c840c2c93 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 5 Nov 2022 22:32:56 +0000 Subject: [PATCH] Improved url detection --- src/Module/Api/Mastodon/Accounts/Search.php | 3 ++- src/Module/Api/Mastodon/Search.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php index 71f867d48..71f6f82da 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 2acfb90ef..b21ff50f2 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); }