From d69c78ceb969c8bef50743d03308d145f0b08a75 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 5 Jan 2021 15:06:00 -0600 Subject: [PATCH] Remove configurability of upload proxy opts, simplify --- config/config.exs | 8 -------- lib/pleroma/web/plugs/uploaded_media.ex | 9 ++++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/config/config.exs b/config/config.exs index d6d116314..7b14fbfe5 100644 --- a/config/config.exs +++ b/config/config.exs @@ -63,14 +63,6 @@ config :pleroma, Pleroma.Upload, filters: [Pleroma.Upload.Filter.Dedupe], link_name: false, proxy_remote: false, - proxy_opts: [ - redirect_on_failure: false, - max_body_length: 25 * 1_048_576, - http: [ - follow_redirect: true, - pool: :upload - ] - ], filename_display_max_length: 30, default_description: nil diff --git a/lib/pleroma/web/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex index 402a8bb34..94b4c2177 100644 --- a/lib/pleroma/web/plugs/uploaded_media.ex +++ b/lib/pleroma/web/plugs/uploaded_media.ex @@ -87,8 +87,15 @@ defmodule Pleroma.Web.Plugs.UploadedMedia do end defp get_media(conn, {:url, url}, true, _) do + proxy_opts = [ + http: [ + follow_redirect: true, + pool: :upload + ] + ] + conn - |> Pleroma.ReverseProxy.call(url, Pleroma.Config.get([Pleroma.Upload, :proxy_opts], [])) + |> Pleroma.ReverseProxy.call(url, proxy_opts) end defp get_media(conn, {:url, url}, _, _) do