From f52a1d1ec5d44eb882b7bebf4d3242737ff9701b Mon Sep 17 00:00:00 2001 From: href Date: Tue, 13 Nov 2018 23:41:33 +0100 Subject: [PATCH] media_proxy: use path only to retrieve filename --- lib/pleroma/web/media_proxy/controller.ex | 2 +- lib/pleroma/web/media_proxy/media_proxy.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/media_proxy/controller.ex b/lib/pleroma/web/media_proxy/controller.ex index 10e6b4e52..bb257c262 100644 --- a/lib/pleroma/web/media_proxy/controller.ex +++ b/lib/pleroma/web/media_proxy/controller.ex @@ -30,7 +30,7 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do with true <- Keyword.get(config, :enabled, false), {:ok, url} <- Pleroma.Web.MediaProxy.decode_url(sig, url), - filename <- Path.basename(url), + filename <- Path.basename(URI.parse(url).path), true <- if(Map.get(params, "filename"), do: filename == Path.basename(conn.request_path), diff --git a/lib/pleroma/web/media_proxy/media_proxy.ex b/lib/pleroma/web/media_proxy/media_proxy.ex index 6819c0917..93c36b4ed 100644 --- a/lib/pleroma/web/media_proxy/media_proxy.ex +++ b/lib/pleroma/web/media_proxy/media_proxy.ex @@ -15,7 +15,7 @@ defmodule Pleroma.Web.MediaProxy do base64 = Base.url_encode64(url, @base64_opts) sig = :crypto.hmac(:sha, secret, base64) sig64 = sig |> Base.url_encode64(@base64_opts) - filename = Path.basename(url) + filename = Path.basename(URI.parse(url).path) Keyword.get(config, :base_url, Pleroma.Web.base_url()) <> "/proxy/#{sig64}/#{base64}/#{filename}" -- 2.45.2