Allow nil attachments
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
FloatingGhost 2023-07-17 20:03:31 +01:00
parent fa40db6b5a
commit 33e7ae7637
1 changed files with 6 additions and 2 deletions

View File

@ -919,9 +919,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
end
def prepare_attachments(object) do
attachments = case Map.get(object, "attachment", []) do
[_ | _] = list -> list
_ -> []
end
attachments =
object
|> Map.get("attachment", [])
attachments
|> Enum.map(fn data ->
[%{"mediaType" => media_type, "href" => href} = url | _] = data["url"]