defmodule Pleroma.Object.Fetcher do
+ alias Pleroma.HTTP
alias Pleroma.Object
alias Pleroma.Object.Containment
alias Pleroma.Web.ActivityPub.Transmogrifier
require Logger
- @httpoison Application.get_env(:pleroma, :httpoison)
-
defp reinject_object(data) do
Logger.debug("Reinjecting object #{data["id"]}")
with true <- String.starts_with?(id, "http"),
{:ok, %{body: body, status: code}} when code in 200..299 <-
- @httpoison.get(
+ HTTP.get(
id,
[{:Accept, "application/activity+json"}]
),
:ok <- Containment.contain_origin_from_id(id, data) do
{:ok, data}
else
+ {:ok, %{status: code}} when code in [404, 410] ->
+ {:error, "Object has been deleted"}
+
e ->
{:error, e}
end