diff --git a/appservice.py b/appservice.py index 8ffcfc8..59050f5 100644 --- a/appservice.py +++ b/appservice.py @@ -258,15 +258,16 @@ def raw_from_event(event): else: value['height'] = 200 if 'thumbnail_info' in event['content']['info']: - value['thumbnail_url'] = app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['info']['thumbnail_url'][6:] - if 'w' in event['content']['info']['thumbnail_info']: - value['thumbnail_width'] = event['content']['info']['thumbnail_info']['w'] - else: - value['thumbnail_width'] = 200 - if 'h' in event['content']['info']['thumbnail_info']: - value['thumbnail_height'] = event['content']['info']['thumbnail_info']['h'] - else: - value['thumbnail_height'] = 200 + if 'thumbnail_url' in event['content']['info']: + value['thumbnail_url'] = app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['info']['thumbnail_url'][6:] + if 'w' in event['content']['info']['thumbnail_info']: + value['thumbnail_width'] = event['content']['info']['thumbnail_info']['w'] + else: + value['thumbnail_width'] = 200 + if 'h' in event['content']['info']['thumbnail_info']: + value['thumbnail_height'] = event['content']['info']['thumbnail_info']['h'] + else: + value['thumbnail_height'] = 200 elif event['content']['msgtype'] == 'm.video': # TODO: Need to sort out the oembed for this media type