Merge branch 'fork' into backend-new
This commit is contained in:
commit
8dd3a8897d
1 changed files with 2 additions and 0 deletions
|
@ -614,6 +614,7 @@ def render("card.json", _), do: nil
|
||||||
|
|
||||||
def render("attachment.json", %{attachment: attachment}) do
|
def render("attachment.json", %{attachment: attachment}) do
|
||||||
[attachment_url | _] = attachment["url"]
|
[attachment_url | _] = attachment["url"]
|
||||||
|
attachment_type = attachment["type"]
|
||||||
media_type = attachment_url["mediaType"] || attachment_url["mimeType"] || "image"
|
media_type = attachment_url["mediaType"] || attachment_url["mimeType"] || "image"
|
||||||
href_remote = attachment_url["href"]
|
href_remote = attachment_url["href"]
|
||||||
href = href_remote |> MediaProxy.url()
|
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, "image") -> "image"
|
||||||
String.contains?(media_type, "video") -> "video"
|
String.contains?(media_type, "video") -> "video"
|
||||||
String.contains?(media_type, "audio") -> "audio"
|
String.contains?(media_type, "audio") -> "audio"
|
||||||
|
attachment_type in ~w[Audio Image Video] -> attachment_type |> String.downcase()
|
||||||
true -> "unknown"
|
true -> "unknown"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue