summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-08-05 15:17:14 +0100
committerGitHub <noreply@github.com>2016-08-05 15:17:14 +0100
commit3f5ac150b20b8c3760c9dfabb84ab47f1c872a8c (patch)
tree242d1616bf2af5bd31d4d6efa66aea68f8b04f27 /synapse
parentMerge pull request #987 from matrix-org/erikj/fix_backfill_auth (diff)
parentDon't include html comments in description (diff)
downloadsynapse-3f5ac150b20b8c3760c9dfabb84ab47f1c872a8c.tar.xz
Merge pull request #988 from matrix-org/erikj/ignore_comments_preview
Don't include html comments in description
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 4060593f7f..bdd0e60c5b 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -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)