ChatMessage: Tolerate attachment field set to an empty array

Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3224
This commit is contained in:
Haelwenn (lanodan) Monnier 2023-12-29 05:23:01 +01:00
commit 39dc6c65ef
3 changed files with 21 additions and 0 deletions

View file

@ -57,6 +57,11 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatMessageValidator do
|> Map.put("attachment", attachment)
end
def fix_attachment(%{"attachment" => attachment} = data) when attachment == [] do
data
|> Map.drop(["attachment"])
end
def fix_attachment(data), do: data
def changeset(struct, data) do