summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorJeyachandran Rathnam <jai.rathnem@gmail.com>2023-01-09 09:22:02 -0500
committerGitHub <noreply@github.com>2023-01-09 14:22:02 +0000
commitbabeeb4e7a6f5b5c643b837bf724d674805546f6 (patch)
treeab7413393109e7b3cd4d65173b73f713ef2e4d11 /tests/rest
parentImprove /sync performance of when passing filters with empty arrays. (#14786) (diff)
downloadsynapse-babeeb4e7a6f5b5c643b837bf724d674805546f6.tar.xz
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.
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/media/v1/test_oembed.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/rest/media/v1/test_oembed.py b/tests/rest/media/v1/test_oembed.py
index 319ae8b1cc..3f7f1dbab9 100644
--- a/tests/rest/media/v1/test_oembed.py
+++ b/tests/rest/media/v1/test_oembed.py
@@ -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&#8217;t a Good Configuration Language"}
+        )
+        self.assertEqual(
+            result.open_graph_result["og:title"],
+            "Why JSON isn’t a Good Configuration Language",
+        )