Merge pull request #988 from matrix-org/erikj/ignore_comments_preview

Don't include html comments in description
This commit is contained in:
Erik Johnston 2016-08-05 15:17:14 +01:00 committed by GitHub
commit 3f5ac150b2

View File

@ -345,7 +345,8 @@ class PreviewUrlResource(Resource):
# lines)
text_nodes = (
re.sub(r'\s+', '\n', el.text).strip()
for el in cloned_tree.iter() if el.text
for el in cloned_tree.iter()
if el.text and isinstance(el.tag, basestring) # Removes comments
)
og['og:description'] = summarize_paragraphs(text_nodes)