diff options
author | Mark Felder <feld@feld.me> | 2023-06-07 09:19:22 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2023-06-07 09:19:22 -0400 |
commit | fadcd7f1a9e41ec9b54f251cf782688bf3d36889 (patch) | |
tree | 39ac8410fcfda00a0ea97fbff0763e10255cc5e5 /test | |
parent | 43458cb7a144f984d2d745e50b8a992c7482265c (diff) | |
download | pleroma-fadcd7f1a9e41ec9b54f251cf782688bf3d36889.tar.gz pleroma-fadcd7f1a9e41ec9b54f251cf782688bf3d36889.zip |
Revert MediaProxy Host header validation
Something is going wrong here even though the tests are correct.
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/media_proxy/media_proxy_controller_test.exs | 29 | ||||
-rw-r--r-- | test/support/conn_case.ex | 5 |
2 files changed, 1 insertions, 33 deletions
diff --git a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs index deb407709..9ce092fd8 100644 --- a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs +++ b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs @@ -54,35 +54,6 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do } = get(conn, "/proxy/hhgfh/eeee/fff") end - test "it returns a 302 for invalid host", %{conn: conn} do - new_proxy_base = "http://mp.localhost/" - - %{scheme: new_proxy_scheme, host: new_proxy_host, port: new_proxy_port} = - URI.parse(new_proxy_base) - - clear_config([:media_proxy, :base_url], new_proxy_base) - - proxy_url = - MediaProxy.encode_url("https://pleroma.social/logo.jpeg") - |> URI.parse() - |> Map.put(:host, "wronghost") - |> URI.to_string() - - expected_url = - URI.parse(proxy_url) - |> Map.put(:host, new_proxy_host) - |> Map.put(:port, new_proxy_port) - |> Map.put(:scheme, new_proxy_scheme) - |> URI.to_string() - - with_mock Pleroma.ReverseProxy, - call: fn _conn, _url, _opts -> %Conn{status: :success} end do - conn = get(conn, proxy_url) - - assert redirected_to(conn, 302) == expected_url - end - end - test "redirects to valid url when filename is invalidated", %{conn: conn, url: url} do invalid_url = String.replace(url, "test.png", "test-file.png") response = get(conn, invalid_url) diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index c1cb0295b..f010fec33 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -120,9 +120,6 @@ defmodule Pleroma.Web.ConnCase do Mox.verify_on_exit!() - {:ok, - conn: - Phoenix.ConnTest.build_conn() - |> Map.put(:host, Pleroma.Web.Endpoint.host())} + {:ok, conn: Phoenix.ConnTest.build_conn()} end end |