updated tests
[akkoma] / lib / pleroma / object / fetcher.ex
index fecc97c5e5635861aa8ca592c96024d4697bce41..cea33b5af26e9ef3a56b12f688ca63a6de0c5a52 100644 (file)
@@ -6,8 +6,8 @@ defmodule Pleroma.Object.Fetcher do
   alias Pleroma.HTTP
   alias Pleroma.Object
   alias Pleroma.Object.Containment
-  alias Pleroma.Signature
   alias Pleroma.Repo
+  alias Pleroma.Signature
   alias Pleroma.Web.ActivityPub.InternalFetchActor
   alias Pleroma.Web.ActivityPub.Transmogrifier
   alias Pleroma.Web.OStatus
@@ -48,10 +48,12 @@ defmodule Pleroma.Object.Fetcher do
   end
 
   def refetch_object(%Object{data: %{"id" => id}} = object) do
-    with {:ok, data} <- fetch_and_contain_remote_object_from_id(id),
+    with {:local, false} <- {:local, String.starts_with?(id, Pleroma.Web.base_url() <> "/")},
+         {:ok, data} <- fetch_and_contain_remote_object_from_id(id),
          {:ok, object} <- reinject_object(object, data) do
       {:ok, object}
     else
+      {:local, true} -> object
       e -> {:error, e}
     end
   end