Unescape HTML entities in oEmbed titles. (#14781)

It doesn't seem valid that HTML entities should appear in
the title field of oEmbed responses, but a popular WordPress
plug-in seems to do it.

There should not be harm in unescaping these.
This commit is contained in:
Jeyachandran Rathnam 2023-01-09 09:22:02 -05:00 committed by GitHub
parent 7e582a25f8
commit babeeb4e7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View file

@ -150,3 +150,13 @@ class OEmbedTests(HomeserverTestCase):
result = self.parse_response({"type": "link"})
self.assertIn("og:type", result.open_graph_result)
self.assertEqual(result.open_graph_result["og:type"], "website")
def test_title_html_entities(self) -> None:
"""Test HTML entities in title"""
result = self.parse_response(
{"title": "Why JSON isn’t a Good Configuration Language"}
)
self.assertEqual(
result.open_graph_result["og:title"],
"Why JSON isnt a Good Configuration Language",
)