RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.11k stars 10.36k forks source link

Images from Whatsapp/Twillio integration dont work on 3.11.0 version #20568

Open leolage opened 3 years ago

leolage commented 3 years ago

Description:

Images from Whatsapp/Twillio integration dont work more

After update to version 3.11.0 all imagens receveid from livechat in whatsapp/twillio integration dont work more, all imagens have a broken url.

Steps to reproduce:

  1. Customer send image to rocketchat in Whatsapp. We using trillio integration with whatsapp
  2. On rockethcat our tech staff receive all text messages of customer, but image is broken
  3. When staff click on broken image, the link is 404 error
  4. see the attachement on this bug report with error

Expected behavior:

messages receive need to show images sended by customers

Actual behavior:

images-rc

rockechat-404

Server Setup Information:

Client Setup Information

Additional context

This problem ocorruing after update to 3.11.0 version

Relevant logs:

Feb 2 11:06:00 HO-RocketChat rocketchat: server.js:204 SyncedCron ➔ info Starting "Generate download files for user data". Feb 2 11:06:00 HO-RocketChat rocketchat: server.js:204 SyncedCron ➔ info Finished "Generate download files for user data". Feb 2 11:06:06 HO-RocketChat rocketchat: server.js:204 API ➔ debug POST: /api/v1/livechat/sms-incoming/twilio Feb 2 11:06:08 HO-RocketChat rocketchat: server.js:204 Integrations ➔ Outgoing WebHook.debug Execute Trigger: sendMessage Feb 2 11:06:08 HO-RocketChat rocketchat: server.js:204 Integrations ➔ Outgoing WebHook.debug Got the event arguments for the event: sendMessage { Feb 2 11:06:08 HO-RocketChat rocketchat: event: 'sendMessage', Feb 2 11:06:08 HO-RocketChat rocketchat: message: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: rid: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: token: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: msg: '', Feb 2 11:06:08 HO-RocketChat rocketchat: attachments: [ [Object] ], Feb 2 11:06:08 HO-RocketChat rocketchat: file: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'DxKo2hLWFZsXPjCcr', Feb 2 11:06:08 HO-RocketChat rocketchat: name: 'Upload File', Feb 2 11:06:08 HO-RocketChat rocketchat: type: 'image/jpeg' Feb 2 11:06:08 HO-RocketChat rocketchat: }, Feb 2 11:06:08 HO-RocketChat rocketchat: ts: 2021-02-02T14:06:08.404Z, Feb 2 11:06:08 HO-RocketChat rocketchat: u: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'PxWjXqLde5vbNLSQH', Feb 2 11:06:08 HO-RocketChat rocketchat: username: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: name: undefined Feb 2 11:06:08 HO-RocketChat rocketchat: }, Feb 2 11:06:08 HO-RocketChat rocketchat: tmid: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: _updatedAt: 2021-02-02T14:06:08.440Z, Feb 2 11:06:08 HO-RocketChat rocketchat: editedBy: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: editedAt: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: emoji: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: avatar: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: alias: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: customFields: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: groupable: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: reactions: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: parseUrls: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: blocks: undefined, Feb 2 11:06:08 HO-RocketChat rocketchat: mentions: [], Feb 2 11:06:08 HO-RocketChat rocketchat: channels: [], Feb 2 11:06:08 HO-RocketChat rocketchat: newRoom: false, Feb 2 11:06:08 HO-RocketChat rocketchat: showConnecting: true Feb 2 11:06:08 HO-RocketChat rocketchat: }, Feb 2 11:06:08 HO-RocketChat rocketchat: room: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: msgs: 3, Feb 2 11:06:08 HO-RocketChat rocketchat: usersCount: 2, Feb 2 11:06:08 HO-RocketChat rocketchat: lm: 2021-02-02T14:05:55.526Z, Feb 2 11:06:08 HO-RocketChat rocketchat: fname: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: t: 'l', Feb 2 11:06:08 HO-RocketChat rocketchat: ts: 2021-02-02T14:04:55.803Z, Feb 2 11:06:08 HO-RocketChat rocketchat: departmentId: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: v: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: username: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: token: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: status: 'online', Feb 2 11:06:08 HO-RocketChat rocketchat: lastMessageTs: 2021-02-02T14:04:55.889Z Feb 2 11:06:08 HO-RocketChat rocketchat: }, Feb 2 11:06:08 HO-RocketChat rocketchat: cl: false, Feb 2 11:06:08 HO-RocketChat rocketchat: open: true, Feb 2 11:06:08 HO-RocketChat rocketchat: sms: { from: 'whatsapp:+xxxhiddenxxx' }, Feb 2 11:06:08 HO-RocketChat rocketchat: _updatedAt: 2021-02-02T14:05:55.581Z, Feb 2 11:06:08 HO-RocketChat rocketchat: lastMessage: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: rid: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: msg: 'oi', Feb 2 11:06:08 HO-RocketChat rocketchat: ts: 2021-02-02T14:05:55.526Z, Feb 2 11:06:08 HO-RocketChat rocketchat: u: [Object], Feb 2 11:06:08 HO-RocketChat rocketchat: _updatedAt: 2021-02-02T14:05:55.568Z, Feb 2 11:06:08 HO-RocketChat rocketchat: mentions: [], Feb 2 11:06:08 HO-RocketChat rocketchat: channels: [] Feb 2 11:06:08 HO-RocketChat rocketchat: }, Feb 2 11:06:08 HO-RocketChat rocketchat: metrics: { Feb 2 11:06:08 HO-RocketChat rocketchat: v: [Object], Feb 2 11:06:08 HO-RocketChat rocketchat: reaction: [Object], Feb 2 11:06:08 HO-RocketChat rocketchat: response: [Object], Feb 2 11:06:08 HO-RocketChat rocketchat: servedBy: [Object] Feb 2 11:06:08 HO-RocketChat rocketchat: }, Feb 2 11:06:08 HO-RocketChat rocketchat: responseBy: { Feb 2 11:06:08 HO-RocketChat rocketchat: _id: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: username: 'xxxhiddenxxx', Feb 2 11:06:08 HO-RocketChat rocketchat: lastMessageTs: 2021-02-02T14:05:55.580Z Feb 2 11:06:08 HO-RocketChat rocketchat: } Feb 2 11:06:08 HO-RocketChat rocketchat: } Feb 2 11:06:08 HO-RocketChat rocketchat: } Feb 2 11:06:08 HO-RocketChat rocketchat: server.js:204 Integrations ➔ Outgoing WebHook.debug Starting search for triggers for the room: xxxhiddenxxx Feb 2 11:06:08 HO-RocketChat rocketchat: server.js:204 Integrations ➔ Outgoing WebHook.debug Found 0 to iterate over and see if the match the event. Feb 2 11:06:09 HO-RocketChat rocketchat: server.js:204 API ➔ debug POST: /api/v1/method.call/readMessages Feb 2 11:06:09 HO-RocketChat rocketchat: server.js:204 Meteor ➔ method readMessages -> userId: xxxhiddenxxx, arguments: ["xxxhiddenxxx"] Feb 2 11:06:09 HO-RocketChat rocketchat: server.js:204 API ➔ debug Success { Feb 2 11:06:09 HO-RocketChat rocketchat: statusCode: 200, Feb 2 11:06:09 HO-RocketChat rocketchat: body: { message: '{"msg":"result","id":"58"}', success: true } Feb 2 11:06:09 HO-RocketChat rocketchat: }

leolage commented 3 years ago

More details about the problem, in the source code or rocketchat, url of image is:

<a href="/file-upload/nbuSiDZvekooQA5kA/Upload%20File" class="rcx-box rcx-box--full rcx-css-16uxknr">December 31, 1969</a>

vmcemin commented 3 years ago

Hi we have same problem, just as you described

leolage commented 3 years ago

Today I updated my rocket chat version to 3.12 but problem persists here. Nobody with the same problem? Only me and @vmcemin ?

vmcemin commented 3 years ago

We upgrade to 3.12 and the problem persists @leolage. Our implementation is in AWS under Ubuntu 20.04 Nginx as a proxy, and with docker as the implementation method. We have activated S3 to save files. I have noticed that if you right click on the link and select save as, the file is downloaded and it is possible to view it. In the same way, if you copy the link, and open it in a new tab, the images will open, just as if you doit with the notepad. This only affects the images sent by WhatsApp and does not affect the WebChat.

In my opinion it is a matter of how the link is generated, since as exposes in the link, the direct path to the file comes, without adding the name of the file.

leolage commented 3 years ago

You are right vmcemin. probably is a problem on url of attached file printed on system. I used GridFS, I tried to change to Filesystem storage and same problem continues ocorring, but in all choices, if I click to open link I can view the file.

lecooliver commented 3 years ago

I have the same problem using S3.

vmcemin commented 3 years ago

We also use S3. We have noticed that in the Ios application the images are displayed correctly (it recognizes the MIME type and displays it), however in the file name header it displays them as undefined. I think the problem is not linked with the type of storage, it's like the key that links the name of the file was broken ...

leolage commented 3 years ago

Today I updated my RocketChat to version 3.15.0 and this problem has been fixed.

Thanks for help