This commit is contained in:
Maksim Pechnikov 2018-12-10 09:39:57 +03:00
commit e94c3442f4
8 changed files with 31 additions and 27 deletions

View file

@ -8,7 +8,6 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
with config <- Pleroma.Config.get([:media_proxy], []),
true <- Keyword.get(config, :enabled, false),
{:ok, url} <- MediaProxy.decode_url(sig64, url64),
_filename <- Path.basename(URI.parse(url).path),
:ok <- filename_matches(Map.has_key?(params, "filename"), conn.request_path, url) do
ReverseProxy.call(conn, url, Keyword.get(config, :proxy_opts, @default_proxy_opts))
else
@ -31,9 +30,10 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
path = URI.decode(path)
cond do
has_filename && filename && Path.basename(path) != filename -> {:wrong_filename, filename}
true -> :ok
if has_filename && filename && Path.basename(path) != filename do
{:wrong_filename, filename}
else
:ok
end
end
end