summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-05-23 13:26:28 +0100
committerGitHub <noreply@github.com>2017-05-23 13:26:28 +0100
commit9a804b28124f1c5a62c5f49d3bbed3f4d7452531 (patch)
tree3304309e120dafe8b2ff609ab682dd6bc7781968
parentMerge pull request #2237 from matrix-org/erikj/sync_key_count (diff)
parentactually trim oversize og:description meta (diff)
downloadsynapse-9a804b28124f1c5a62c5f49d3bbed3f4d7452531.tar.xz
Merge pull request #2243 from matrix-org/matthew/fix-url-preview-length-again
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