get size of image to pass to info, not image

Resolves issue #54
This commit is contained in:
Morgan McMillian 2021-03-05 21:14:11 -08:00
parent 06c8055fb2
commit fc617a2c67

View file

@ -134,8 +134,8 @@ def new_media(room_id, msg):
dl.raise_for_status() dl.raise_for_status()
with magic.Magic(flags=magic.MAGIC_MIME_TYPE) as m: with magic.Magic(flags=magic.MAGIC_MIME_TYPE) as m:
info['mimetype'] = m.id_buffer(dl.content) info['mimetype'] = m.id_buffer(dl.content)
info['size'] = dl.content info['size'] = len(dl.content)
ul = matrix_api.media_upload(dl.content, mtype) ul = matrix_api.media_upload(dl.content, info['mimetype'])
if 'title' in oembed: if 'title' in oembed:
title = oembed.title title = oembed.title