- assume defaults for image that does not contain height or width

issue #41
This commit is contained in:
Morgan McMillian 2019-02-02 15:14:24 -08:00
parent dbf3d5e1ae
commit 55eb6177fe

View file

@ -201,8 +201,14 @@ def raw_from_event(event):
value['url'] = url
value['title'] = event['content']['body']
if 'info' in event['content']:
value['width'] = event['content']['info']['w']
value['height'] = event['content']['info']['h']
if 'w' in event['content']['info']:
value['width'] = event['content']['info']['w']
else:
value['width'] = 200
if 'h' in event['content']['info']:
value['height'] = event['content']['info']['h']
else:
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']