diff --git a/lib/pleroma/http/adapter_helper/hackney.ex b/lib/pleroma/http/adapter_helper/hackney.ex index f3be1f3d0..f3451cf9c 100644 --- a/lib/pleroma/http/adapter_helper/hackney.ex +++ b/lib/pleroma/http/adapter_helper/hackney.ex @@ -16,7 +16,12 @@ defmodule Pleroma.HTTP.AdapterHelper.Hackney do config_opts = Pleroma.Config.get([:http, :adapter], []) + url_encoding = + Keyword.new() + |> Keyword.put(:path_encode_fun, fn path -> path end) + @defaults + |> Keyword.merge(url_encoding) |> Keyword.merge(config_opts) |> Keyword.merge(connection_opts) |> add_scheme_opts(uri) diff --git a/lib/pleroma/reverse_proxy/client/hackney.ex b/lib/pleroma/reverse_proxy/client/hackney.ex index d3e986912..0aa5f5715 100644 --- a/lib/pleroma/reverse_proxy/client/hackney.ex +++ b/lib/pleroma/reverse_proxy/client/hackney.ex @@ -7,6 +7,11 @@ defmodule Pleroma.ReverseProxy.Client.Hackney do @impl true def request(method, url, headers, body, opts \\ []) do + opts = + Keyword.put_new(opts, :path_encode_fun, fn path -> + path + end) + :hackney.request(method, url, headers, body, opts) end diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index 3595568cf..8dbe9c6bf 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -396,7 +396,7 @@ defmodule Pleroma.ReverseProxyTest do end end - # Hackey is used for Reverse Proxy when Hackney or Finch is the Tesla Adapter + # Hackney is used for Reverse Proxy when Hackney or Finch is the Tesla Adapter # Gun is able to proxy through Tesla, so it does not need testing as the # test cases in the Pleroma.HTTPTest module are sufficient describe "Hackney URL encoding:" do