commit: 67dd81e8254576950fc20ed84d3da3a3d24c1706
parent d472bafec19cee269e7c943bafae7c805785acd7
Author: Mark Felder <feld@feld.me>
Date: Tue, 26 Dec 2023 16:05:28 -0500
Consolidate the HTTP status code checking into the private get_object/1
Diffstat:
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/pleroma/object/fetcher.ex b/lib/pleroma/object/fetcher.ex
@@ -99,15 +99,6 @@ defmodule Pleroma.Object.Fetcher do
{:fetch_object, %Object{} = object} ->
{:ok, object}
- {:fetch, {:error, {:ok, %Tesla.Env{status: 403}}}} ->
- Instances.set_consistently_unreachable(id)
-
- Logger.error(
- "Error while fetching #{id}: HTTP 403 likely due to instance block rejecting the signed fetch."
- )
-
- {:error, "Object fetch has been denied"}
-
{:fetch, {:error, error}} ->
Logger.error("Error while fetching #{id}: #{inspect(error)}")
{:error, error}
@@ -221,6 +212,10 @@ defmodule Pleroma.Object.Fetcher do
{:error, {:content_type, nil}}
end
+ {:ok, %{status: 403}} ->
+ Instances.set_consistently_unreachable(id)
+ {:error, "Object fetch has been denied"}
+
{:ok, %{status: code}} when code in [404, 410] ->
{:error, "Object has been deleted"}