diff options
author | call-me-matt <nextcloud@matthiasheinisch.de> | 2023-01-28 13:15:56 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-02-02 08:29:43 +0000 |
commit | 3d2517db0cd19549fc89a85e405879c4519da0a8 (patch) | |
tree | 561759e9efcac15bd4d074e9456fc03edf6d2c17 | |
parent | d8168c7a407953b48ab3a44512eee5e1a9c5f008 (diff) |
prioritize local users in mastodon avatar download, fixes #3210backport/3211/stable4.2
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
-rw-r--r-- | lib/Service/Social/MastodonProvider.php | 2 | ||||
-rw-r--r-- | tests/unit/Service/Social/MastodonProviderTest.php | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Service/Social/MastodonProvider.php b/lib/Service/Social/MastodonProvider.php index b43bd17f..35d3d0dd 100644 --- a/lib/Service/Social/MastodonProvider.php +++ b/lib/Service/Social/MastodonProvider.php @@ -106,7 +106,7 @@ class MastodonProvider implements ISocialProvider { try { [$masto_user, $masto_server] = $masto_user_server; # search for user on Mastodon - $search = $masto_server . '/api/v2/search?q=' . $masto_user; + $search = $masto_server . '/api/v2/search?q=' . $masto_user . '@' . parse_url($masto_server)["host"]; $result = $this->httpClient->get($search); $jsonResult = json_decode($result->getBody()); # take first search result diff --git a/tests/unit/Service/Social/MastodonProviderTest.php b/tests/unit/Service/Social/MastodonProviderTest.php index db1d6fc3..26d59caf 100644 --- a/tests/unit/Service/Social/MastodonProviderTest.php +++ b/tests/unit/Service/Social/MastodonProviderTest.php @@ -98,9 +98,9 @@ class MastodonProviderTest extends TestCase { ] ]; $contactWithSocialUrls = [ - "https://cloud1/api/v2/search?q=user1", - "https://cloud2/api/v2/search?q=user2", - "https://cloud3//api/v2/search?q=user3", + "https://cloud1/api/v2/search?q=user1@cloud1", + "https://cloud2/api/v2/search?q=user2@cloud2", + "https://cloud3//api/v2/search?q=user3@cloud3", "https://cloud1/api/v1/accounts/1", "https://cloud2/api/v1/accounts/2", "https://cloud3//api/v1/accounts/3" |