Improved url detection

This commit is contained in:
Michael 2022-11-05 22:32:56 +00:00
parent 70d0f087b7
commit db12814f3b
2 changed files with 4 additions and 2 deletions

View file

@ -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']);
}

View file

@ -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);
}