From 12fa5541f01ca5cfe082a62dac3317da78043e8f Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 30 Jun 2020 15:58:53 +0300 Subject: [PATCH] FollowRedirects: Unconditionally release the connection if there is an error There is no need for streaming the body if there is no body --- lib/pleroma/tesla/middleware/follow_redirects.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pleroma/tesla/middleware/follow_redirects.ex b/lib/pleroma/tesla/middleware/follow_redirects.ex index f2c502c69..5a7032215 100644 --- a/lib/pleroma/tesla/middleware/follow_redirects.ex +++ b/lib/pleroma/tesla/middleware/follow_redirects.ex @@ -55,6 +55,10 @@ defmodule Pleroma.HTTP.Middleware.FollowRedirects do release_conn(opts) {:error, {__MODULE__, :too_many_redirects}} + {:error, _} = e -> + release_conn(opts) + e + other -> unless opts[:body_as] == :chunks do release_conn(opts)