ArticleNotePageValidator: Fix when attachments are a Map (ie. owncast)

This commit is contained in:
Haelwenn (lanodan) Monnier 2022-07-22 20:02:53 +02:00
parent c589b8445f
commit be98900904

View file

@ -65,6 +65,11 @@ defp fix_replies(%{"replies" => replies} = data) when is_bitstring(replies),
defp fix_replies(data), do: data
def fix_attachments(%{"attachment" => attachment} = data) when is_map(attachment),
do: Map.put(data, "attachment", [attachment])
def fix_attachments(data), do: data
defp fix(data) do
data
|> CommonFixes.fix_actor()
@ -72,6 +77,7 @@ defp fix(data) do
|> fix_url()
|> fix_tag()
|> fix_replies()
|> fix_attachments()
|> Transmogrifier.fix_emoji()
|> Transmogrifier.fix_content_map()
end