summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-02 18:50:03 +0100
committerErik Johnston <erik@matrix.org>2016-08-02 18:50:24 +0100
commit58c9653c6b7f258ed24fe509e2db1664d90ae866 (patch)
tree46e0816dde697d3761744f24fe1ed3fc459efa67 /synapse/rest
parentComment on why we clone (diff)
downloadsynapse-58c9653c6b7f258ed24fe509e2db1664d90ae866.tar.xz
Don't infer paragrahs from newlines
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 64ad218f70..ebd07d696b 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -344,9 +344,8 @@ class PreviewUrlResource(Resource):
                 # Split all the text nodes into paragraphs (by splitting on new
                 # lines)
                 text_nodes = (
-                    line.strip()
+                    re.sub(r'\s+', '\n', el.text).strip()
                     for el in cloned_tree.iter() if el.text
-                    for line in el.text.splitlines()
                 )
 
                 # Try to get a summary of between 200 and 500 words, respecting