diff --git a/appservice.py b/appservice.py index fb90285..fc4e4a1 100644 --- a/appservice.py +++ b/appservice.py @@ -211,8 +211,14 @@ def raw_from_event(event): value['height'] = 200 if 'thumbnail_info' in event['content']['info']: value['thumbnail_url'] = app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['info']['thumbnail_url'][6:] - value['thumbnail_width'] = event['content']['info']['thumbnail_info']['w'] - value['thumbnail_height'] = event['content']['info']['thumbnail_info']['h'] + 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