From 9061d148bedb2685c460b098bebae13b05587f84 Mon Sep 17 00:00:00 2001 From: Oneric Date: Sun, 24 Mar 2024 17:32:28 -0100 Subject: [PATCH] =?UTF-8?q?Ensure=20object=20id=20doesn=E2=80=99t=20change?= =?UTF-8?q?=20on=20refetch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pleroma/object/fetcher.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pleroma/object/fetcher.ex b/lib/pleroma/object/fetcher.ex index 263f9a4fa..e51262de4 100644 --- a/lib/pleroma/object/fetcher.ex +++ b/lib/pleroma/object/fetcher.ex @@ -117,10 +117,12 @@ defp reinject_object(%Object{} = object, new_data) 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