From 9be286a9004ae60f8ea48bb0c8871d70223f082b Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 1 Nov 2017 09:33:29 +0100 Subject: [PATCH] Handle empty terms / tags. --- lib/pleroma/web/ostatus/ostatus.ex | 4 +++- test/fixtures/ostatus_incoming_post_tag.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex index 1e8b71357..308e206c5 100644 --- a/lib/pleroma/web/ostatus/ostatus.ex +++ b/lib/pleroma/web/ostatus/ostatus.ex @@ -169,7 +169,9 @@ def get_cw(entry) do def get_tags(entry) do :xmerl_xpath.string('//category', entry) - |> Enum.map(fn (category) -> string_from_xpath("/category/@term", category) |> String.downcase end) + |> Enum.map(fn (category) -> string_from_xpath("/category/@term", category) end) + |> Enum.filter(&(&1)) + |> Enum.map(&String.downcase/1) end def maybe_update(doc, user) do diff --git a/test/fixtures/ostatus_incoming_post_tag.xml b/test/fixtures/ostatus_incoming_post_tag.xml index 5febb80d1..0f99c4126 100644 --- a/test/fixtures/ostatus_incoming_post_tag.xml +++ b/test/fixtures/ostatus_incoming_post_tag.xml @@ -43,6 +43,7 @@ New note by lambadalambda Will it blend? + http://activitystrea.ms/schema/1.0/post