From 02ca1d1efea87eb9ff78897219c31474841320a3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 14 Nov 2020 21:28:01 +0100 Subject: [PATCH] Fix matrix bot avatar --- .../management/commands/fix_matrix_channels.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/participation/management/commands/fix_matrix_channels.py b/apps/participation/management/commands/fix_matrix_channels.py index 764b41e..ec7802b 100644 --- a/apps/participation/management/commands/fix_matrix_channels.py +++ b/apps/participation/management/commands/fix_matrix_channels.py @@ -16,10 +16,8 @@ class Command(BaseCommand): if not os.path.isfile(".matrix_avatar"): stat_file = os.stat("corres2math/static/logo.png") with open("corres2math/static/logo.png", "rb") as f: - resp, _ = Matrix.upload(f, filename="logo.png", content_type="image/png", - filesize=stat_file.st_size) - if not hasattr(resp, "content_uri"): - raise Exception(resp) + resp = Matrix.upload(f, filename="logo.png", content_type="image/png", + filesize=stat_file.st_size)[0][0] avatar_uri = resp.content_uri with open(".matrix_avatar", "w") as f: f.write(avatar_uri)