From: rinpatch <rinpatch@sdf.org>
Date: Tue, 30 Jun 2020 12:58:53 +0000 (+0300)
Subject: FollowRedirects: Unconditionally release the connection if there is an error
X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=12fa5541f01ca5cfe082a62dac3317da78043e8f;p=akkoma

FollowRedirects: Unconditionally release the connection if there is an error

There is no need for streaming the body if there is no body
---

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)