Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media uploads from Discord bridge are not uploaded over to Telegram #935

Open
TomTheDragon opened this issue Oct 26, 2023 · 4 comments
Open

Comments

@TomTheDragon
Copy link

I have a Matrix room with a Telegram and a Discord bridge and i just noticed that all media uploads from the Discord side, do not get send over to the Telegram side. It does however work fine the other way around.
My guess is that the Telegram bridge has problems with the "faked" direct media (i use the redirect method) links which the discord bridge is using.

Here is an error log:

[2023-10-26 21:44:37,001] [[email protected]] xxx.xx.xxx.xx [26/Oct/2023:21:44:36 +0000] "PUT /_matrix/app/v1/transactions/82649 HTTP/1.1" 200 159 "-" "Synapse/1.94.0"
[2023-10-26 21:44:37,009] [[email protected]] Received Matrix event $bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb from @tom:foxyden.eu in !xxxxxxxxxxxxxxxxxxx:yyyyyyyyy.zz
[2023-10-26 21:44:37,395] [[email protected]] Uploading file of 62 bytes in 1 chunks of 131072
[2023-10-26 21:44:37,457] [[email protected]] RPCError while bridging $bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: Failure while processing image (caused by SendMediaRequest)
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/portal.py", line 2178, in handle_matrix_message
    await self._handle_matrix_message(sender, content, event_id)
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/portal.py", line 2347, in _handle_matrix_message
    await self._handle_matrix_file(
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/portal.py", line 1938, in _handle_matrix_file
    response = await client.send_media(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/tgclient.py", line 77, in send_media
    return self._get_response_message(request, await self(request), entity)
                                               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/telethon/client/users.py", line 91, in _call
    result = await future
             ^^^^^^^^^^^^
telethon.errors.rpcerrorlist.ImageProcessFailedError: Failure while processing image (caused by SendMediaRequest)
[2023-10-26 21:44:37,463] [[email protected]] Exception in Matrix event handler
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/as_handler.py", line 342, in try_handle
    await handler_func(event)
  File "/usr/lib/python3.11/site-packages/mautrix/bridge/matrix.py", line 1061, in int_handle_event
    await self.handle_message(evt, was_encrypted=was_encrypted)
  File "/usr/lib/python3.11/site-packages/mautrix/bridge/matrix.py", line 660, in handle_message
    await portal.handle_matrix_message(sender, message, event_id)
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/portal.py", line 2178, in handle_matrix_message
    await self._handle_matrix_message(sender, content, event_id)
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/portal.py", line 2347, in _handle_matrix_message
    await self._handle_matrix_file(
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/portal.py", line 1938, in _handle_matrix_file
    response = await client.send_media(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix_telegram/tgclient.py", line 77, in send_media
    return self._get_response_message(request, await self(request), entity)
                                               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/telethon/client/users.py", line 91, in _call
    result = await future
             ^^^^^^^^^^^^
telethon.errors.rpcerrorlist.ImageProcessFailedError: Failure while processing image (caused by SendMediaRequest)
@TomTheDragon
Copy link
Author

I did some more testing and i also tried the proxy method for the discord bridge, but the telegram one still has problems with uploading/sending media.

@TomTheDragon
Copy link
Author

The new "Direct media access" function of the discord bridge fixed it.

@TomTheDragon
Copy link
Author

Sorry for closing this too early, after some more testing i found that its still a problem.
Only GIFs which are send over discords GIF function are working now.

When i for example send a picture on discord, the discord bridge is sending this correctly but its like the telegram bridge can not see the links.

Discord URL: https://cdn.discordapp.com/attachments/543030866390024203/1266718896107425813/aaa.png?ex=66a62b67&is=66a4d9e7&hm=317d43c18a22e1fb160cba8079b250f164745140f5f9938288c9141f1e6a702d&
Matrix URL: https://foxyden.eu/_matrix/media/r0/download/discord-media.foxyden.eu/8J-QiERJU0NPUkQBAQeJO7IlQAALEZRKH_XCAF4RlEof6MIQFa5CGAYbEtgy_Lq2JjhA9AA

I was checking the logs of the nginx which proxies over the connection for the discord bridge media and it shows that an non functioning url was requested: https://foxyden.eu/_matrix/media/v3/download/discord-media.foxyden.eu/8J-QiERJU0NPUkQBAQeJO7IlQAALEZRKH_XCAF4RlEof6MIQFa5CGAYbEtgy_Lq2JjhA9AA?allow_remote=false&timeout_ms=20000&allow_redirect=true

However if i change allow_remote to true, it works.
So i am not sure if this is an bug or if there needs to be some extra rewrite rule or something for nginx to fix the problem.

@TomTheDragon TomTheDragon reopened this Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant