Merge branch 'fork' into backend-new

This commit is contained in:
marcin mikołajczak 2024-09-07 14:16:37 +02:00
commit 8dd3a8897d

View file

@ -614,6 +614,7 @@ def render("card.json", _), do: nil
def render("attachment.json", %{attachment: attachment}) do
[attachment_url | _] = attachment["url"]
attachment_type = attachment["type"]
media_type = attachment_url["mediaType"] || attachment_url["mimeType"] || "image"
href_remote = attachment_url["href"]
href = href_remote |> MediaProxy.url()
@ -625,6 +626,7 @@ def render("attachment.json", %{attachment: attachment}) do
String.contains?(media_type, "image") -> "image"
String.contains?(media_type, "video") -> "video"
String.contains?(media_type, "audio") -> "audio"
attachment_type in ~w[Audio Image Video] -> attachment_type |> String.downcase()
true -> "unknown"
end