]> git.mxchange.org Git - friendica.git/commitdiff
Improved url detection
authorMichael <heluecht@pirati.ca>
Sat, 5 Nov 2022 22:32:56 +0000 (22:32 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 5 Nov 2022 22:32:56 +0000 (22:32 +0000)
src/Module/Api/Mastodon/Accounts/Search.php
src/Module/Api/Mastodon/Search.php

index 71f867d48bf35308484c9da1d5f3f8f89491d491..71f6f82dab74fe2002ab03148307a7cb9938a769 100644 (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']);
                        }
 
index 2acfb90efa1a05fb6a4b125b2fef1a54fdcbbb6e..b21ff50f29d8a7f6a5094a915b9a7c41f2911fc8 100644 (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);
                        }