summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-03-29 03:32:55 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-03-29 03:32:55 +0100
commitae5831d30354c713cd1693f3b74cf048de7428a7 (patch)
tree289461e82ee3ffef11af885fa7b2491ea986fcd7
parentimplement redirects (diff)
downloadsynapse-ae5831d30354c713cd1693f3b74cf048de7428a7.tar.xz
fix bugs
Diffstat (limited to '')
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 4f7c9e3d1b..b999944e86 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -57,15 +57,15 @@ class PreviewUrlResource(BaseMediaResource):
 
             if self._is_media(media_info['media_type']):
                 dims = yield self._generate_local_thumbnails(
-                        media_info.filesystem_id, media_info
+                        media_info['filesystem_id'], media_info
                       )
 
                 og = {
-                    "og:description" : media_info.download_name,
-                    "og:image" : "mxc://%s/%s" % (self.server_name, media_info.filesystem_id),
+                    "og:description" : media_info['download_name'],
+                    "og:image" : "mxc://%s/%s" % (self.server_name, media_info['filesystem_id']),
                     "og:image:type" : media_info['media_type'],
-                    "og:image:width" : dims.width,
-                    "og:image:height" : dims.height,
+                    "og:image:width" : dims['width'],
+                    "og:image:height" : dims['height'],
                 }
 
                 # define our OG response for this media
@@ -123,6 +123,7 @@ class PreviewUrlResource(BaseMediaResource):
                 length, headers = yield self.client.get_file(
                     url, output_stream=f, max_size=self.max_spider_size,
                 )
+                # FIXME: handle 404s sanely - don't spider an error page
             media_type = headers["Content-Type"][0]
             time_now_ms = self.clock.time_msec()