diff --git a/appservice.py b/appservice.py index 76f02a3..13bec39 100644 --- a/appservice.py +++ b/appservice.py @@ -155,8 +155,11 @@ def new_sticker(event, user): value = {'type': "photo", 'version': "1.0"} value['url'] = app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['url'][6:] value['title'] = event['content']['body'] - value['width'] = event['content']['info']['thumbnail_info']['w'] - value['height'] = event['content']['info']['thumbnail_info']['h'] + if 'h' in event['content']['info'] and 'w' in event['content']['info']: + value['height'] = event['content']['info']['h'] + value['width'] = event['content']['info']['h'] + else: + return raw = {'type': "io.pnut.core.oembed", 'value': value} embed = [raw] text = prefix + text