EvolutionAPI / evolution-api

Evolution API is an open-source WhatsApp integration API
https://evolution-api.com
GNU General Public License v3.0
1.54k stars 727 forks source link

Links having chars replaced #920

Open drecchia opened 12 hours ago

drecchia commented 12 hours ago

Welcome!

What did you do?

When user send an link with '-_', chatwoot receives/displays wrong link with '-*'. This do no happens when link is sent to telegram inbox.

What did you expect?

The same link.

What did you observe instead of what you expected?

This link is received on chatwoot inbox: https://produto.mercadolivre.com.br/MLB-3224361780-raquete-tennis-tenis-wilson-pro-staff-97-v14-16x19-315g-*JM?attributes=COLOR*SECONDARY_COLOR:QnJvbnplIEZvc2Nv

Screenshots/Videos

image image

Which version of the API are you using?

v2.1.1

What is your environment?

Docker

Other environment specifications

No response

If applicable, paste the log output

Webhook fired FROM chatwoot:

{"account":{"id":1,"name":"Vortus Solutions"},"additional_attributes":{},"content_attributes":{},"content_type":"text","content":"https://produto.mercadolivre.com.br/MLB-3224361780-raquete-tennis-tenis-wilson-pro-staff-97-v14-16x19-315g-*JM?attributes=COLOR*SECONDARY_COLOR:QnJvbnplIEZvc2Nv","conversation":{"additional_attributes":{},"can_reply":true,"channel":"Channel::Api","contact_inbox":{"id":37,"contact_id":36,"inbox_id":1,"source_id":"d8c5f8cd-d6fc-4a81-b51c-4f18dcdbed46","created_at":"2024-07-26T21:45:53.000Z","updated_at":"2024-09-24T21:31:31.065Z","hmac_verified":false,"pubsub_token":"4yGemCk4RJnidqvieiXYxqf1"},"id":36,"inbox_id":1,"messages":[{"id":10719,"content":"https://produto.mercadolivre.com.br/MLB-3224361780-raquete-tennis-tenis-wilson-pro-staff-97-v14-16x19-315g-*JM?attributes=COLOR*SECONDARY_COLOR:QnJvbnplIEZvc2Nv","account_id":1,"inbox_id":1,"conversation_id":36,"message_type":0,"created_at":1727349192,"updated_at":"2024-09-26T11:13:12.169Z","private":false,"status":"sent","source_id":"WAID:0EE97E3FC3BB911EE35A2A115C9FD1F8","content_type":"text","content_attributes":{},"sender_type":"Contact","sender_id":36,"external_source_ids":{},"additional_attributes":{},"processed_message_content":"https://produto.mercadolivre.com.br/MLB-3224361780-raquete-tennis-tenis-wilson-pro-staff-97-v14-16x19-315g-*JM?attributes=COLOR*SECONDARY_COLOR:QnJvbnplIEZvc2Nv","sentiment":{},"conversation":{"assignee_id":1,"unread_count":1,"last_activity_at":1727349192,"contact_inbox":{"source_id":"d8c5f8cd-d6fc-4a81-b51c-4f18dcdbed46"}},"sender":{"additional_attributes":{},"custom_attributes":{},"email":null,"id":36,"identifier":"xxxxxxxxxx@s.whatsapp.net","name":"Malu","phone_number":"+xxxxxxxxxxx","thumbnail":"https://chat-3gkjx86.cluster.vortus.solutions/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--40cd937ae6ee9578a6e60aa52392e5a3db12576f/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--3a361edf5c101f2a238bfa62ceca02884da782dc/347513628_136937529380649_710962996454459250_n.jpg","type":"contact"}}],"labels":[],"meta":{"sender":{"additional_attributes":{},"custom_attributes":{},"email":null,"id":36,"identifier":"xxxxxxxxxxx@s.whatsapp.net","name":"Malu","phone_number":"+xxxxxxxxxxxx","thumbnail":"https://chat-3gkjx86.cluster.vortus.solutions/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--40cd937ae6ee9578a6e60aa52392e5a3db12576f/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--3a361edf5c101f2a238bfa62ceca02884da782dc/347513628_136937529380649_710962996454459250_n.jpg","type":"contact"},"assignee":{"id":1,"name":"Admin","available_name":"Admin","avatar_url":"","type":"user","availability_status":null,"thumbnail":""},"team":null,"hmac_verified":false},"status":"open","custom_attributes":{},"snoozed_until":null,"unread_count":1,"first_reply_created_at":null,"priority":null,"waiting_since":1727349192,"agent_last_seen_at":1727349017,"contact_last_seen_at":0,"last_activity_at":1727349192,"timestamp":1727349192,"created_at":1722030353},"created_at":"2024-09-26T11:13:12.169Z","id":10719,"inbox":{"id":1,"name":"Whats"},"message_type":"incoming","status":"sent","private":false,"sender":{"account":{"id":1,"name":"Vortus Solutions"},"additional_attributes":{},"avatar":"https://chat-3gkjx86.cluster.vortus.solutions/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--40cd937ae6ee9578a6e60aa52392e5a3db12576f/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--3a361edf5c101f2a238bfa62ceca02884da782dc/347513628_136937529380649_710962996454459250_n.jpg","custom_attributes":{},"email":null,"id":36,"identifier":"xxxxxxxxxxxx@s.whatsapp.net","name":"Malu","phone_number":"+xxxxxxxxxx","thumbnail":"https://chat-3gkjx86.cluster.vortus.solutions/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--40cd937ae6ee9578a6e60aa52392e5a3db12576f/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--3a361edf5c101f2a238bfa62ceca02884da782dc/347513628_136937529380649_710962996454459250_n.jpg"},"source_id":"WAID:0EE97E3FC3BB911EE35A2A115C9FD1F8","event":"message_created"}

Additional Notes

Example link: https://produto.mercadolivre.com.br/MLB-3224361780-raquete-tennis-tenis-wilson-pro-staff-97-v14-16x19-315g-_JM?attributes=COLOR_SECONDARY_COLOR:QnJvbnplIEZvc2Nv

dpaes commented 7 hours ago

i think its only the "*" caracter the problem, because in another place in this same url, like COLORSECONDARY_COLOR, he judge like COLOR_SECONDARY_COLOR. And u can improve some change if u already know which links have the "*" caracter, putting the "\" in the left of the "\", then will appear like u want. its an suggestion of course

drecchia commented 7 hours ago

Kind of weird, i cant figure the exact pattern. If it was "_" all COLOR_SECONDARY_COLOR should have been buggy. And also notice the first "*" that appears before JM as displayed on image. Maybe some crazy regex is acting over the link and mutating it.

dpaes commented 3 hours ago

i dont know, but if u find the pattern, can be fix or bypass the problem