ignore malformed sticker messages

resolves issue #60
This commit is contained in:
Morgan McMillian 2022-08-13 08:16:59 -07:00
parent 24d1258265
commit ee6baaa579

View file

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