From d960d926a0b0ac0939246e6c169e2c304c266adf Mon Sep 17 00:00:00 2001 From: Roman Chvanikov Date: Wed, 9 Dec 2020 00:49:28 +0300 Subject: [PATCH] wip --- lib/pleroma/web/activity_pub/activity_pub.ex | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 3a8b17baa..f9483d82e 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -165,10 +165,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp maybe_update_media(%Object{data: %{"attachment" => []}}), do: :ok defp maybe_update_media(%Object{id: id, data: %{"attachment" => attachments}}) do - Enum.each(attachments, fn %{"id" => media_id} -> - media_id - |> Pleroma.Media.get_by_id() - |> Pleroma.Media.update(%{object_id: id}) + Enum.each(attachments, fn data -> + with %{"id" => media_id} <- data do + media_id + |> Pleroma.Media.get_by_id() + |> Pleroma.Media.update(%{object_id: id}) + end end) end