Ensure object id doesn’t change on refetch
This commit is contained in:
parent
3e134b07fa
commit
9061d148be
1 changed files with 2 additions and 0 deletions
|
@ -117,10 +117,12 @@ defmodule Pleroma.Object.Fetcher do
|
|||
def refetch_object(%Object{data: %{"id" => id}} = object) do
|
||||
with {:local, false} <- {:local, Object.local?(object)},
|
||||
{:ok, new_data} <- fetch_and_contain_remote_object_from_id(id),
|
||||
{:id, true} <- {:id, new_data["id"] == id},
|
||||
{:ok, object} <- reinject_object(object, new_data) do
|
||||
{:ok, object}
|
||||
else
|
||||
{:local, true} -> {:ok, object}
|
||||
{:id, false} -> {:error, "Object id changed on refetch"}
|
||||
e -> {:error, e}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue