Nothing much just a build up of things
[anni] / patches / 3(fix_searches_p3).patch
1 From 8e8b3be31345ce18150b38ebbe84a3fc23f13e0e Mon Sep 17 00:00:00 2001
2 From: Mint <>
3 Date: Wed, 31 May 2023 20:17:33 +0300
4 Subject: [PATCH] Use Tesla's middleware for redirect handling on Hackney
5
6 ---
7  lib/pleroma/http.ex                        | 6 +++++-
8  lib/pleroma/http/adapter_helper/hackney.ex | 2 --
9  2 files changed, 5 insertions(+), 3 deletions(-)
10
11 diff --git a/lib/pleroma/http.ex b/lib/pleroma/http.ex
12 index a0e7d80f83..6c430fc2d0 100644
13 --- a/lib/pleroma/http.ex
14 +++ b/lib/pleroma/http.ex
15 @@ -107,7 +107,11 @@ defp adapter_middlewares(Tesla.Adapter.Gun) do
16    end
17  
18    defp adapter_middlewares(Tesla.Adapter.Hackney) do
19 -    [Tesla.Middleware.FollowRedirects]
20 +    if Pleroma.Config.get([:http, :adapter, :follow_redirect]) != false do
21 +      [Tesla.Middleware.FollowRedirects]
22 +    else
23 +      []
24 +    end
25    end
26  
27    defp adapter_middlewares(_) do
28 diff --git a/lib/pleroma/http/adapter_helper/hackney.ex b/lib/pleroma/http/adapter_helper/hackney.ex
29 index f3be1f3d0f..15a84cf736 100644
30 --- a/lib/pleroma/http/adapter_helper/hackney.ex
31 +++ b/lib/pleroma/http/adapter_helper/hackney.ex
32 @@ -6,8 +6,6 @@ defmodule Pleroma.HTTP.AdapterHelper.Hackney do
33    @behaviour Pleroma.HTTP.AdapterHelper
34  
35    @defaults [
36 -    follow_redirect: true,
37 -    force_redirect: true
38    ]
39  
40    @spec options(keyword(), URI.t()) :: keyword()
41 -- 
42 GitLab
43