Simplify. We will always have a result from Upload.base_url/0, so just add it to...
authorMark Felder <feld@feld.me>
Mon, 11 Jan 2021 20:19:14 +0000 (14:19 -0600)
committerMark Felder <feld@feld.me>
Mon, 11 Jan 2021 20:19:14 +0000 (14:19 -0600)
lib/pleroma/web/media_proxy.ex

index 1dab35d2ca952d749e0ccf866d8a295cd90b2369..dcf3b062315c40ac2dc6d9e1ced6c419c5c080e1 100644 (file)
@@ -73,22 +73,14 @@ defmodule Pleroma.Web.MediaProxy do
 
   def whitelisted?(url) do
     %{host: domain} = URI.parse(url)
-    %{host: web_domain} = Web.base_url() |> URI.parse()
-    %{host: upload_domain} = Upload.base_url() |> URI.parse()
 
     mediaproxy_whitelist_domains =
       [:media_proxy, :whitelist]
       |> Config.get()
+      |> Kernel.++(["#{Upload.base_url()}"])
       |> Enum.map(&maybe_get_domain_from_url/1)
 
-    whitelist_domains =
-      if web_domain == upload_domain do
-        mediaproxy_whitelist_domains
-      else
-        [upload_domain | mediaproxy_whitelist_domains]
-      end
-
-    domain in whitelist_domains
+    domain in mediaproxy_whitelist_domains
   end
 
   defp maybe_get_domain_from_url("http" <> _ = url) do