Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
4a6d48b0
Commit
4a6d48b0
authored
Mar 30, 2017
by
lain
Browse files
Return mimetype with attachment.
parent
32aa83f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/upload.ex
View file @
4a6d48b0
...
...
@@ -8,7 +8,11 @@ def store(%Plug.Upload{} = file) 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
}
...
...
lib/pleroma/web/twitter_api/twitter_api.ex
View file @
4a6d48b0
...
...
@@ -99,6 +99,10 @@ def unfollow(%User{} = follower, followed_id) 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...
"""
<?xml version="1.0" encoding="UTF-8"?>
...
...
@@ -106,9 +110,9 @@ def upload(%Plug.Upload{} = file) do
<mediaid>#{object.id}</mediaid>
<media_id>#{object.id}</media_id>
<media_id_string>#{object.id}</media_id_string>
<media_url>#{
object.data["
href
"]
}</media_url>
<mediaurl>#{
object.data["
href
"]
}</mediaurl>
<atom:link rel="enclosure" href="#{
object.data["
href
"]
}" type="
image
"></atom:link>
<media_url>#{href}</media_url>
<mediaurl>#{href}</mediaurl>
<atom:link rel="enclosure" href="#{href}" type="
#{type}
"></atom:link>
</rsp>
"""
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment