transmogrifier: get_actor called without casting attributedTo in actor and actor...
[akkoma] / lib / pleroma / web / activity_pub / transmogrifier.ex
index 7bdb9594a0c390a3dc3e1515b03c981a6c8356d3..aece77a5401fbe71177e1a2c584ee00163aefeba 100644 (file)
@@ -30,6 +30,10 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     id
   end
 
+  def get_actor(%{"actor" => nil, "attributedTo" => actor}) when not is_nil(actor) do
+    get_actor(%{"actor" => actor})
+  end
+
   @doc """
   Checks that an imported AP object's actor matches the domain it came from.
   """
@@ -159,12 +163,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   end
 
   def fix_attachments(%{"attachment" => attachment} = object) when is_map(attachment) do
-    attachment =
-      Map.put(attachment, "url", [
-        %{"type" => "Link", "mediaType" => attachment["mediaType"], "href" => attachment["url"]}
-      ])
-
-    Map.put(object, "attachment", attachment)
+    Map.put(object, "attachment", [attachment])
+    |> fix_attachments()
   end
 
   def fix_attachments(object), do: object