poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
957 stars 119 forks source link

/upload succeeds but uploaded file is not displayed in buffer #304

Closed AlexBocken closed 2 years ago

AlexBocken commented 2 years ago

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.

AlexBocken commented 2 years ago

I can fix this error by just commenting out the culprit as can be seen here: https://github.com/AlexBocken/weechat-matrix/commit/b10723d15a3a08e769200acbfe6c36e5598ac8f0

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

poljar commented 2 years ago

Does changing from mimetype to mime fix it as well?

AlexBocken commented 2 years ago

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

poljar commented 2 years ago

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

AlexBocken commented 2 years ago

perfect, will do.