twitter api: fix mimetype fallback when attachments use a URI instead of a URL object

This commit is contained in:
William Pitcock 2018-09-19 04:58:17 +00:00
parent 0cac493fdc
commit c9585ec007

View File

@ -17,7 +17,7 @@ def to_map(%Object{data: %{"url" => [url | _]}} = object, _opts) do
def to_map(%Object{data: %{"url" => url} = data}, _opts) when is_binary(url) do def to_map(%Object{data: %{"url" => url} = data}, _opts) when is_binary(url) do
%{ %{
url: url |> Pleroma.Web.MediaProxy.url(), url: url |> Pleroma.Web.MediaProxy.url(),
mimetype: data["mediaType"] || url["mimeType"], mimetype: data["mediaType"] || data["mimeType"],
id: data["uuid"], id: data["uuid"],
oembed: false, oembed: false,
description: data["name"] description: data["name"]