handle missing thumbnail info, issue #46
This commit is contained in:
parent
264dee0176
commit
8f0d383e20
1 changed files with 8 additions and 2 deletions
|
@ -211,8 +211,14 @@ def raw_from_event(event):
|
||||||
value['height'] = 200
|
value['height'] = 200
|
||||||
if 'thumbnail_info' in event['content']['info']:
|
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_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']
|
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']
|
value['thumbnail_height'] = event['content']['info']['thumbnail_info']['h']
|
||||||
|
else:
|
||||||
|
value['thumbnail_height'] = 200
|
||||||
|
|
||||||
elif event['content']['msgtype'] == 'm.video':
|
elif event['content']['msgtype'] == 'm.video':
|
||||||
# TODO: Need to sort out the oembed for this media type
|
# TODO: Need to sort out the oembed for this media type
|
||||||
|
|
Loading…
Reference in a new issue