From: Roger Braun Date: Wed, 1 Nov 2017 08:33:29 +0000 (+0100) Subject: Handle empty terms / tags. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=9be286a9004ae60f8ea48bb0c8871d70223f082b;p=akkoma Handle empty terms / tags. --- 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 @@ defmodule Pleroma.Web.OStatus 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