poljar/weechat-matrix

/upload succeeds but uploaded file is not displayed in buffer

Closed this issue · 5 comments

I know the current state of the project and weechat-matrix-rs. Since this pertains to a wrapper script (matrix_upload.py) I'm hoping that I still can find some help here.

I have come across an error while uploading files. The upload itself succeeds but the uploaded file cannot be displayed in the current buffer.
Only after rebooting weechat is the file properly displayed.
I get the following error in my first buffer:

Traceback (most recent call last):
  File "/home/alex/.config/weechat/python/matrix/utf.py", line 89, in wrapper
    return function(*args, **kwargs)
  File "/home/alex/.config/weechat/python/autoload/matrix.py", line 343, in receive_cb
    server.handle_response(response)
  File "/home/alex/.config/weechat/python/matrix/server.py", line 1736, in handle_response
    ret = self.room_send_upload(item.message)
  File "/home/alex/.config/weechat/python/matrix/server.py", line 1055, in room_send_upload
    upload.render,
  File "/home/alex/.config/weechat/python/matrix/uploads.py", line 211, in render
    return Render.encrypted_media(
TypeError: encrypted_media() got an unexpected keyword argument 'mimetype'
python: error in function "receive_cb"

This is of course in an encrypted buffer as you can guess from the error Traceback. Let me know if you need any more information to further solve this issue.

I can fix this error by just commenting out the culprit as can be seen here:
AlexBocken@b10723d

But I'm not confident myself whether this is the correct way to go if you want this to be a clean fix.

Does changing from mimetype to mime fix it as well?

Ah yes, mime=self.file_keys.get("mimetype"), seems to work.

Seems like a copy/paste error, a PR that changes to mime is very much welcome.

perfect, will do.