B Providers/ActivityPub: Ensure that nothing explodes on unexpected input.
This commit is contained in:
parent
60ec42cb9c
commit
5b3e4cf49b
@ -16,4 +16,7 @@ defmodule Pleroma.Web.Metadata.Providers.ActivityPub do
|
|||||||
def build_tags(%{user: user}) do
|
def build_tags(%{user: user}) do
|
||||||
[{:link, [rel: "alternate", type: "application/activity+json", href: user.ap_id], []}]
|
[{:link, [rel: "alternate", type: "application/activity+json", href: user.ap_id], []}]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Provider
|
||||||
|
def build_tags(_), do: []
|
||||||
end
|
end
|
||||||
|
@ -31,4 +31,10 @@ defmodule Pleroma.Web.Metadata.Providers.ActivityPubTest do
|
|||||||
[rel: "alternate", type: "application/activity+json", href: object.data["id"]], []}
|
[rel: "alternate", type: "application/activity+json", href: object.data["id"]], []}
|
||||||
] == result
|
] == result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it returns an empty array for anything else" do
|
||||||
|
result = ActivityPub.build_tags(%{})
|
||||||
|
|
||||||
|
assert result == []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user