diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 777c7429e2..1f9c9dcf87 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -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