handle missing thumbnail info, issue #46

This commit is contained in:
Morgan McMillian 2020-03-22 22:06:38 -07:00
parent 264dee0176
commit 8f0d383e20

View file

@ -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:]
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