fix: update file upload to use RC 8.x rooms.media API
Description:
File uploads fail with a 404 Not Found error when using EmbeddedChat with Rocket.Chat 8.x servers. The sendAttachment function uses the deprecated /api/v1/rooms.upload/:rid endpoint which was replaced in RC 8.x with a new two-step process using /api/v1/rooms.media/:rid and /api/v1/rooms.mediaConfirm/:rid/:fileId.
Steps to reproduce:
- Connect EmbeddedChat to a Rocket.Chat 8.x server
- Log in to the chat
- Try to upload a file (image, document, etc.) using the attachment button
- Observe the network request failing with 404
Expected behavior:
File should upload successfully and appear in the chat.
Actual behavior:
Upload fails with: POST http://localhost:3000/api/v1/rooms.upload/{roomId} 404 (Not Found)sendAttachment error: Server error 404 404 Not Found
The file is never uploaded because Rocket.Chat 8.x uses the new rooms.media + rooms.mediaConfirm two-step process
https://github.com/user-attachments/assets/0f9b7b0b-429a-44c7-9fd2-ebfd7a0526ec
Hoping this issue happens globally due to, hitting the old file upload endpoint