Apply suggestions from code review
Co-Authored-By: Brendan Abolivier <babolivier@matrix.org> Co-Authored-By: Erik Johnston <erik@matrix.org>
This commit is contained in:
parent
e9bfe719ba
commit
e78167c94b
|
@ -518,7 +518,7 @@ def _calc_og(tree, media_uri):
|
||||||
if "content" in tag.attrib:
|
if "content" in tag.attrib:
|
||||||
# if we've got more than 50 tags, someone is taking the piss
|
# if we've got more than 50 tags, someone is taking the piss
|
||||||
if len(og) >= 50:
|
if len(og) >= 50:
|
||||||
logger.warning("skipping OG for page with too many og: tags")
|
logger.warning("Skipping OG for page with too many 'og:' tags")
|
||||||
return {}
|
return {}
|
||||||
og[tag.attrib["property"]] = tag.attrib["content"]
|
og[tag.attrib["property"]] = tag.attrib["content"]
|
||||||
|
|
||||||
|
|
|
@ -279,6 +279,7 @@ class URLPreviewTests(unittest.HomeserverTestCase):
|
||||||
self.pump()
|
self.pump()
|
||||||
self.assertEqual(channel.code, 200)
|
self.assertEqual(channel.code, 200)
|
||||||
res = channel.json_body
|
res = channel.json_body
|
||||||
|
# We should only see the `og:description` field, as `title` is too long and should be stripped out
|
||||||
self.assertCountEqual(["og:description"], res.keys())
|
self.assertCountEqual(["og:description"], res.keys())
|
||||||
|
|
||||||
def test_ipaddr(self):
|
def test_ipaddr(self):
|
||||||
|
|
Loading…
Reference in New Issue