activitypub: transmogrifier: do not allow missing lists to be interpreted as nil
authorWilliam Pitcock <nenolod@dereferenced.org>
Tue, 19 Mar 2019 17:30:25 +0000 (17:30 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Tue, 19 Mar 2019 17:30:25 +0000 (17:30 +0000)
lib/pleroma/web/activity_pub/transmogrifier.ex

index 7f3d8fd4b842c0ce3805f049fb8204fd7a4d38d3..9d536f7f5fd9bbb381cabb536267e3e3952b8d7f 100644 (file)
@@ -86,11 +86,15 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   end
 
   def fix_addressing_list(map, field) do
-    if is_binary(map[field]) do
-      map
-      |> Map.put(field, [map[field]])
-    else
-      map
+    cond do
+      is_binary(map[field]) ->
+        Map.put(map, field, [map[field]])
+
+      is_nil(map[field]) ->
+        Map.put(map, field, [])
+
+      true ->
+        map
     end
   end