From d487b753c3116e7a4261404b2357f337acc2d64d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 19 Mar 2019 17:30:25 +0000 Subject: [PATCH] activitypub: transmogrifier: do not allow missing lists to be interpreted as nil --- lib/pleroma/web/activity_pub/transmogrifier.ex | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 7f3d8fd4b..9d536f7f5 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -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 -- 2.45.2