Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 7c04fdc51..3f67ae406 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -2361,6 +2361,7 @@ defmodule Pleroma.User do
"profile_url" => profile_url,
"subject" => "acct:" <> acct
}} <- WebFinger.finger(account),
+ true <- is_binary(ap_id) and ap_id != "",
true <- same_profile_url?(uri, profile_url) do
ActivityPub.make_user_from_ap_id(ap_id, nickname_from_acct: acct)
else
diff --git a/test/pleroma/user_search_test.exs b/test/pleroma/user_search_test.exs
index ec8e1b2ee..9e1175a6c 100644
--- a/test/pleroma/user_search_test.exs
+++ b/test/pleroma/user_search_test.exs
@@ -353,6 +353,35 @@ defmodule Pleroma.UserSearchTest do
refute_received :fetched_unverified_actor
end
+ test "falls back to the actor fetch when WebFinger has no usable AP self link" do
+ profile_url = "https://social.example/@alice"
+
+ Tesla.Mock.mock(fn
+ %{url: "https://social.example/.well-known/host-meta"} ->
+ {:ok, %Tesla.Env{status: 404}}
+
+ %{
+ url: "https://social.example/.well-known/webfinger?resource=acct:alice@social.example"
+ } ->
+ Tesla.Mock.json(%{
+ "subject" => "acct:alice@social.example",
+ "links" => [
+ %{"rel" => "self", "type" => "application/activity+json", "href" => nil},
+ %{
+ "rel" => "http://webfinger.net/rel/profile-page",
+ "type" => "text/html",
+ "href" => profile_url
+ }
+ ]
+ })
+
+ %{url: ^profile_url} ->
+ {:ok, %Tesla.Env{status: 404}}
+ end)
+
+ assert {:error, _} = User.get_or_fetch(profile_url)
+ end
+
test "verifies the WebFinger account when its advertised actor is cached" do
profile_url = "https://evil.test/@mallory"
actor_id = "https://legit.invalid/users/alice"

File Metadata

Mime Type
text/x-diff
Expires
Fri, Aug 28, 10:26 PM (23 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1736681
Default Alt Text
(1 KB)

Event Timeline