aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-10-29 15:19:32 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-10-29 15:19:32 +0000
commit5c6ec2d9fc0bd9e6b49906ea58f163264c37a54e (patch)
tree53e1dc6cdd0d88c7f09a6443f361aa4f221adbf0 /lib
parent658036881d132e22cb033dff1ac2bdbd74e802a1 (diff)
downloadpleroma-5c6ec2d9fc0bd9e6b49906ea58f163264c37a54e.tar.gz
twitter/mastodon api: always use mediaproxy URLs in attachments
if using local media, the mediaproxy will not replace the URL anyway.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex6
-rw-r--r--lib/pleroma/web/twitter_api/twitter_api.ex3
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 8ffaf8466..80e80c8f5 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -166,7 +166,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"] || "image"
- href = attachment_url["href"]
+ href = attachment_url["href"] |> MediaProxy.url()
type =
cond do
@@ -180,9 +180,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
%{
id: to_string(attachment["id"] || hash_id),
- url: MediaProxy.url(href),
+ url: href,
remote_url: href,
- preview_url: MediaProxy.url(href),
+ preview_url: href,
text_url: href,
type: type,
description: attachment["name"]
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex
index 3747285da..cb483df9d 100644
--- a/lib/pleroma/web/twitter_api/twitter_api.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api.ex
@@ -3,6 +3,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.TwitterAPI.UserView
alias Pleroma.Web.{OStatus, CommonAPI}
+ alias Pleroma.Web.MediaProxy
import Ecto.Query
@instance Application.get_env(:pleroma, :instance)
@@ -97,7 +98,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
{:ok, object} = ActivityPub.upload(file)
url = List.first(object.data["url"])
- href = url["href"]
+ href = url["href"] |> MediaProxy.url()
type = url["mediaType"]
case format do