mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
Handle empty terms / tags.
This commit is contained in:
parent
6f05367325
commit
9be286a900
2 changed files with 4 additions and 1 deletions
|
@ -169,7 +169,9 @@ defmodule Pleroma.Web.OStatus do
|
||||||
|
|
||||||
def get_tags(entry) do
|
def get_tags(entry) do
|
||||||
:xmerl_xpath.string('//category', entry)
|
: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
|
end
|
||||||
|
|
||||||
def maybe_update(doc, user) do
|
def maybe_update(doc, user) do
|
||||||
|
|
1
test/fixtures/ostatus_incoming_post_tag.xml
vendored
1
test/fixtures/ostatus_incoming_post_tag.xml
vendored
|
@ -43,6 +43,7 @@
|
||||||
<title>New note by lambadalambda</title>
|
<title>New note by lambadalambda</title>
|
||||||
<content type="html">Will it blend?</content>
|
<content type="html">Will it blend?</content>
|
||||||
<category term="Nsfw"/>
|
<category term="Nsfw"/>
|
||||||
|
<category term=""/>
|
||||||
<link rel="alternate" type="text/html" href="https://social.heldscal.la/notice/1967725"/>
|
<link rel="alternate" type="text/html" href="https://social.heldscal.la/notice/1967725"/>
|
||||||
<status_net notice_id="1967725"></status_net>
|
<status_net notice_id="1967725"></status_net>
|
||||||
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
||||||
|
|
Loading…
Reference in a new issue