From: Roger Braun Date: Thu, 30 Mar 2017 14:08:23 +0000 (+0200) Subject: Return mimetype with attachment. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4a6d48b0fe991b68b555c75faca095725aff487b;p=akkoma Return mimetype with attachment. --- diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 158656e92..d22421d37 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -8,7 +8,11 @@ defmodule Pleroma.Upload do %{ "type" => "Image", - "href" => url_for(Path.join(uuid, file.filename)), + "url" => [%{ + "type" => "Link", + "mediaType" => file.content_type, + "href" => url_for(Path.join(uuid, file.filename)) + }], "name" => file.filename, "uuid" => uuid } diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index b6e7d5cc6..0624e73aa 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -99,6 +99,10 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do def upload(%Plug.Upload{} = file) do {:ok, object} = ActivityPub.upload(file) + url = List.first(object.data["url"]) + href = url["href"] + type = url["mediaType"] + # Fake this as good as possible... """ @@ -106,9 +110,9 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do #{object.id} #{object.id} #{object.id} - #{object.data["href"]} - #{object.data["href"]} - + #{href} + #{href} + """ end