Check if object->data is array when looking up attachment objects to delete
authorRoman Chvanikov <chvanikoff@pm.me>
Tue, 14 Jan 2020 16:53:28 +0000 (19:53 +0300)
committerRoman Chvanikov <chvanikoff@pm.me>
Tue, 14 Jan 2020 16:53:28 +0000 (19:53 +0300)
lib/pleroma/object.ex

index 2452a7389345af649730392804dde6ecf2e13942..6c56a9c62f005b41a0a9436eda79fb721058b9b9 100644 (file)
@@ -203,7 +203,8 @@ defmodule Pleroma.Object do
       from(o in Object,
         where:
           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,
             ^hrefs
           )