Improved url detection
This commit is contained in:
parent
70d0f087b7
commit
db12814f3b
|
@ -28,6 +28,7 @@ use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\Object\Search\ContactResult;
|
use Friendica\Object\Search\ContactResult;
|
||||||
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://docs.joinmastodon.org/methods/accounts/
|
* @see https://docs.joinmastodon.org/methods/accounts/
|
||||||
|
@ -52,7 +53,7 @@ class Search extends BaseApi
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
|
|
||||||
if ($request['resolve']) {
|
if ($request['resolve']) {
|
||||||
if ((strrpos($request['q'], '@') > 0)) {
|
if ((strrpos($request['q'], '@') > 0) || Network::isValidHttpUrl($request['q'])) {
|
||||||
$results = CoreSearch::getContactsFromProbe($request['q']);
|
$results = CoreSearch::getContactsFromProbe($request['q']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ use Friendica\Model\Post;
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\Object\Search\ContactResult;
|
use Friendica\Object\Search\ContactResult;
|
||||||
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://docs.joinmastodon.org/methods/search/
|
* @see https://docs.joinmastodon.org/methods/search/
|
||||||
|
@ -84,7 +85,7 @@ class Search extends BaseApi
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
|
|
||||||
if ($resolve) {
|
if ($resolve) {
|
||||||
if ((strrpos($q, '@') > 0)) {
|
if ((strrpos($q, '@') > 0) || Network::isValidHttpUrl($q)) {
|
||||||
$results = CoreSearch::getContactsFromProbe($q);
|
$results = CoreSearch::getContactsFromProbe($q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user