summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-05-22 21:14:20 +0100
committerMatthew Hodgson <matthew@matrix.org>2017-05-22 21:14:20 +0100
commit836d5c44b6457a93c0d163e721ded153382d2a79 (patch)
treedc4bcd5a03d40dc2c3dcbf5f7a675b4d229062f1
parentMerge pull request #2231 from aaronraimist/patch-1 (diff)
downloadsynapse-836d5c44b6457a93c0d163e721ded153382d2a79.tar.xz
actually trim oversize og:description meta
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 99760d622f..c680fddab5 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -434,6 +434,8 @@ def _calc_og(tree, media_uri):
                 for el in _iterate_over_text(tree.find("body"), *TAGS_TO_REMOVE)
             )
             og['og:description'] = summarize_paragraphs(text_nodes)
+    else:
+        og['og:description'] = summarize_paragraphs([og['og:description']])
 
     # TODO: delete the url downloads to stop diskfilling,
     # as we only ever cared about its OG