Check if object->data is array when looking up attachment objects to delete

This commit is contained in:
Roman Chvanikov 2020-01-14 19:53:28 +03:00
parent d150c598d7
commit 0709757e47
1 changed files with 2 additions and 1 deletions

View File

@ -203,7 +203,8 @@ defp delete_attachments(%{data: %{"attachment" => [_ | _] = attachments, "actor"
from(o in Object, from(o in Object,
where: where:
fragment( fragment(
"to_jsonb(array(select jsonb_array_elements((?)#>'{url}') ->> 'href'))::jsonb \\?| (?)", "to_jsonb(array(select jsonb_array_elements((?)#>'{url}') ->> 'href' where jsonb_typeof((?)#>'{url}') = 'array'))::jsonb \\?| (?)",
o.data,
o.data, o.data,
^hrefs ^hrefs
) )