mastodon api: default attachment type to image if one is not present
authorWilliam Pitcock <nenolod@dereferenced.org>
Wed, 19 Sep 2018 04:57:28 +0000 (04:57 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 19 Sep 2018 04:59:25 +0000 (04:59 +0000)
lib/pleroma/web/mastodon_api/views/status_view.ex

index 8f6c4b062795fbde1040e7ac5f0dbf72697c11b2..284df837a556e280d0a55c4b61c01c9ec13106c2 100644 (file)
@@ -154,7 +154,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
 
   def render("attachment.json", %{attachment: attachment}) do
     [attachment_url | _] = attachment["url"]
-    media_type = attachment_url["mediaType"] || attachment_url["mimeType"]
+    media_type = attachment_url["mediaType"] || attachment_url["mimeType"] || "image"
     href = attachment_url["href"]
 
     type =