commit: 9be286a9004ae60f8ea48bb0c8871d70223f082b
parent: 6f05367325e7d773ca7199948fd5b49409f6d78d
Author: Roger Braun <roger@rogerbraun.net>
Date: Wed, 1 Nov 2017 09:33:29 +0100
Handle empty terms / tags.
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git 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
@@ -43,6 +43,7 @@
<title>New note by lambadalambda</title>
<content type="html">Will it blend?</content>
<category term="Nsfw"/>
+ <category term=""/>
<link rel="alternate" type="text/html" href="https://social.heldscal.la/notice/1967725"/>
<status_net notice_id="1967725"></status_net>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>