mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Return mimetype with attachment.
This commit is contained in:
parent
32aa83f3a2
commit
4a6d48b0fe
2 changed files with 12 additions and 4 deletions
|
@ -8,7 +8,11 @@ defmodule Pleroma.Upload do
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"type" => "Image",
|
"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,
|
"name" => file.filename,
|
||||||
"uuid" => uuid
|
"uuid" => uuid
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,10 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
||||||
def upload(%Plug.Upload{} = file) do
|
def upload(%Plug.Upload{} = file) do
|
||||||
{:ok, object} = ActivityPub.upload(file)
|
{:ok, object} = ActivityPub.upload(file)
|
||||||
|
|
||||||
|
url = List.first(object.data["url"])
|
||||||
|
href = url["href"]
|
||||||
|
type = url["mediaType"]
|
||||||
|
|
||||||
# Fake this as good as possible...
|
# Fake this as good as possible...
|
||||||
"""
|
"""
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
@ -106,9 +110,9 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
||||||
<mediaid>#{object.id}</mediaid>
|
<mediaid>#{object.id}</mediaid>
|
||||||
<media_id>#{object.id}</media_id>
|
<media_id>#{object.id}</media_id>
|
||||||
<media_id_string>#{object.id}</media_id_string>
|
<media_id_string>#{object.id}</media_id_string>
|
||||||
<media_url>#{object.data["href"]}</media_url>
|
<media_url>#{href}</media_url>
|
||||||
<mediaurl>#{object.data["href"]}</mediaurl>
|
<mediaurl>#{href}</mediaurl>
|
||||||
<atom:link rel="enclosure" href="#{object.data["href"]}" type="image"></atom:link>
|
<atom:link rel="enclosure" href="#{href}" type="#{type}"></atom:link>
|
||||||
</rsp>
|
</rsp>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue