summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-06-15 16:58:05 +0100
committerErik Johnston <erik@matrix.org>2016-06-15 16:58:05 +0100
commit1e9026e484be0f90256ae60c05eed9d1f87cf6b9 (patch)
treeffd45a5a9c841b9e8a5a9db4677033b41092f86b
parentHandle og props with not content (diff)
downloadsynapse-1e9026e484be0f90256ae60c05eed9d1f87cf6b9.tar.xz
Handle floats as img widths
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index fc72896e0c..a6807df620 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -280,7 +280,7 @@ class PreviewUrlResource(Resource):
                 # TODO: consider inlined CSS styles as well as width & height attribs
                 images = tree.xpath("//img[@src][number(@width)>10][number(@height)>10]")
                 images = sorted(images, key=lambda i: (
-                    -1 * int(i.attrib['width']) * int(i.attrib['height'])
+                    -1 * float(i.attrib['width']) * float(i.attrib['height'])
                 ))
                 if not images:
                     images = tree.xpath("//img[@src]")