transmogrifier: Just make attachement maps into a list and reroll

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-09-27 11:38:30 +02:00
parent e53da692fb
commit 9446b02bdf
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
1 changed files with 2 additions and 6 deletions

View File

@ -159,12 +159,8 @@ def fix_attachments(%{"attachment" => attachment} = object) when is_list(attachm
end
def fix_attachments(%{"attachment" => attachment} = object) when is_map(attachment) do
attachment =
Map.put(attachment, "url", [
%{"type" => "Link", "mediaType" => attachment["mediaType"], "href" => attachment["url"]}
])
Map.put(object, "attachment", attachment)
Map.put(object, "attachment", [attachment])
|> fix_attachments()
end
def fix_attachments(object), do: object