Просмотр исходного кода

Handle empty terms / tags.

tags/v0.9.9
Roger Braun 6 лет назад
Родитель
Сommit
9be286a900
2 измененных файлов: 4 добавлений и 1 удалений
  1. +3
    -1
      lib/pleroma/web/ostatus/ostatus.ex
  2. +1
    -0
      test/fixtures/ostatus_incoming_post_tag.xml

+ 3
- 1
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


+ 1
- 0
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>


Загрузка…
Отмена
Сохранить