diff options
author | Erik Johnston <erik@matrix.org> | 2016-06-15 16:58:05 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-06-15 16:58:05 +0100 |
commit | 1e9026e484be0f90256ae60c05eed9d1f87cf6b9 (patch) | |
tree | ffd45a5a9c841b9e8a5a9db4677033b41092f86b | |
parent | Handle og props with not content (diff) | |
download | synapse-1e9026e484be0f90256ae60c05eed9d1f87cf6b9.tar.xz |
Handle floats as img widths
-rw-r--r-- | synapse/rest/media/v1/preview_url_resource.py | 2 |
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]") |