summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHélène <pleroma-dev@helene.moe>2022-08-19 02:45:49 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2022-11-27 04:54:19 +0100
commit542bb1725866304232a1a80b1afeea6c8f2e8fc7 (patch)
tree8ff8a673f5dcb8bf819708265eb948027eee4a6b /lib
parent747311f623190cac9e345e1db3568ed850495ac2 (diff)
downloadpleroma-542bb1725866304232a1a80b1afeea6c8f2e8fc7.tar.gz
pleroma-542bb1725866304232a1a80b1afeea6c8f2e8fc7.zip
ArticleNotePageValidator: fix replies fixing
Some software, like GoToSocial, expose replies as ActivityPub Collections, but do not expose any item array directly in the object, causing validation to fail via the ObjectID validator. Now, Pleroma will drop that field in this situation too.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex
index 0d987116c..825f2082f 100644
--- a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex
+++ b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex
@@ -86,7 +86,10 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
defp fix_replies(%{"replies" => %{"items" => replies}} = data) when is_list(replies),
do: Map.put(data, "replies", replies)
- defp fix_replies(%{"replies" => replies} = data) when is_bitstring(replies),
+ # TODO: Pleroma does not have any support for Collections at the moment.
+ # If the `replies` field is not something the ObjectID validator can handle,
+ # the activity/object would be rejected, which is bad behavior.
+ defp fix_replies(%{"replies" => replies} = data) when not is_list(replies),
do: Map.drop(data, ["replies"])
defp fix_replies(data), do: data