ConnectionPool middleware: fix a crash due to unimplemented behaviour
authorrinpatch <rinpatch@sdf.org>
Sat, 5 Sep 2020 18:17:03 +0000 (21:17 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 5 Sep 2020 18:17:03 +0000 (21:17 +0300)
Structs don't implement Access behaviour, so this crashed. Tests didn't
catch it and I didn't test that part of the codepath. Very sorry

lib/pleroma/tesla/middleware/connection_pool.ex

index 5909e98d69faba3e88f14a7e25383277b3eb7605..049db6eb384f0aaca8c530986fb4ff6a3f5c001f 100644 (file)
@@ -32,7 +32,7 @@ defmodule Pleroma.Tesla.Middleware.ConnectionPool do
           {:ok, env} ->
             unless opts[:adapter][:body_as] == :chunks do
               ConnectionPool.release_conn(conn_pid)
-              {:ok, pop_in(env[:opts][:adapter][:conn])}
+              {:ok, pop_in(env.opts[:adapter][:conn])}
             else
               {:ok, env}
             end