diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2023-07-02 21:25:45 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2023-07-02 21:25:45 +0000 |
commit | 379590d4383810285290dcc0f1ed701f4449e161 (patch) | |
tree | 02f59af6a74590404ccf06044783c2564843ebc8 | |
parent | 8cf231c0d101fc7358180fecd328fb38764da9d1 (diff) | |
parent | a1621839cc31a92e346cbd6065c4db6a8ebeb5a9 (diff) | |
download | pleroma-379590d4383810285290dcc0f1ed701f4449e161.tar.gz pleroma-379590d4383810285290dcc0f1ed701f4449e161.zip |
Merge branch 'tusooa/3142-featured-collection-shouldnt-break-user-fetch' into 'develop'
Fix user fetch completely broken if featured collection is not in a supported form
See merge request pleroma/pleroma!3914
-rw-r--r-- | changelog.d/featured-collection-shouldnt-break-user-fetch.fix | 1 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 5 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_test.exs | 8 |
3 files changed, 14 insertions, 0 deletions
diff --git a/changelog.d/featured-collection-shouldnt-break-user-fetch.fix b/changelog.d/featured-collection-shouldnt-break-user-fetch.fix new file mode 100644 index 000000000..e8ce288cc --- /dev/null +++ b/changelog.d/featured-collection-shouldnt-break-user-fetch.fix @@ -0,0 +1 @@ +Fix user fetch completely broken if featured collection is not in a supported form diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 1a10aef1d..c93288b79 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1720,6 +1720,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end) end + def pin_data_from_featured_collection(obj) do + Logger.error("Could not parse featured collection #{inspect(obj)}") + %{} + end + def fetch_and_prepare_featured_from_ap_id(nil) do {:ok, %{}} end diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 54fc6ef0a..1e8c14043 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -2652,4 +2652,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do {:ok, user} = ActivityPub.make_user_from_ap_id("https://princess.cat/users/mewmew") assert user.name == " " end + + test "pin_data_from_featured_collection will ignore unsupported values" do + assert %{} == + ActivityPub.pin_data_from_featured_collection(%{ + "type" => "OrderedCollection", + "first" => "https://social.example/users/alice/collections/featured?page=true" + }) + end end |