fix(feed): tighten enclosure metadata
This commit is contained in:
parent
2d667e1d2a
commit
5f71532442
7 changed files with 35 additions and 19 deletions
|
|
@ -35,6 +35,7 @@ defmodule Pleroma.Web.Feed.FeedViewTest do
|
|||
assert FeedView.atom_content_encoded(data) == "content warning"
|
||||
assert FeedView.rss_content_encoded(data) == "content warning"
|
||||
assert FeedView.media_content_xml(attachment, true) == ""
|
||||
assert FeedView.media_content_xml(attachment, "true") == ""
|
||||
|
||||
media_content = FeedView.media_content_xml(attachment, false)
|
||||
assert media_content =~ "<media:description type=\"plain\">spoiler</media:description>"
|
||||
|
|
@ -43,4 +44,16 @@ defmodule Pleroma.Web.Feed.FeedViewTest do
|
|||
assert FeedView.media_content_xml(Map.delete(attachment, "name"), false) ==
|
||||
~s(<media:content url="https://example.com/spoiler.png" type="image/png" medium="image"/>\n)
|
||||
end
|
||||
|
||||
test "does not treat a legacy false string as sensitive" do
|
||||
data = %{
|
||||
"attachment" => [
|
||||
%{"url" => [%{"href" => "https://example.com/image.png", "mediaType" => "image/png"}]}
|
||||
],
|
||||
"content" => "visible",
|
||||
"sensitive" => "false"
|
||||
}
|
||||
|
||||
assert FeedView.atom_content_encoded(data) =~ "<img"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -202,9 +202,12 @@ defmodule Pleroma.Web.Feed.UserControllerTest do
|
|||
|> response(200)
|
||||
|> parse()
|
||||
|
||||
assert xpath(rss_xml, ~x"//item/enclosure/@url"sl) == ["https://example.com/file.bin"]
|
||||
assert xpath(rss_xml, ~x"//item/enclosure/@type"sl) == ["application/octet-stream"]
|
||||
assert xpath(rss_xml, ~x"//item/enclosure/@length"sl) == ["0"]
|
||||
assert xpath(rss_xml, ~x"//item/enclosure/@url"sl) == []
|
||||
assert xpath(rss_xml, ~x"//item/media:content/@url"sl) == ["https://example.com/file.bin"]
|
||||
|
||||
assert xpath(rss_xml, ~x"//item/media:content/@type"sl) == [
|
||||
"application/octet-stream"
|
||||
]
|
||||
end
|
||||
|
||||
test "returns 404 for a missing feed", %{conn: conn} do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue