RocketChat / RocketChat/Rocket.Chat
double Url encoding from webhook with whitespace replacement
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
I use the webhook from Rocket.Chat to send messages to a Rocket.Chat channel.
I want to post a message, which contains a link.
Part of the message content ist [LinkName](https://myurl.org/some space/index.html) interpreted by Rocket.Chat as markdown.
The problem is, that the Url contains a whitespace.
In the past, it was possible to encode the url and send it to the Rocket.Chat in the way, that the markdown looked like: LinkName
It looks like this is no longer possible. As I understand the Url ist encoded again from Rocket.Chat. The result I get, when I use the encoded URL is: LinkName
because the % sign is encoded again by Rocket.Chat.
When I do not encode the url by myself, Rocket.Chat does not encode the Url by itself. So sending [LinkName](https://myurl.org/some space/index.html) will still result in [LinkName](https://myurl.org/some space/index.html), means no encoding happened.
Steps to reproduce:
- Create a message with an Link in markdown typeURL contain
- Send the message through the webhook to an Rocket.Chat channel
- Check the send message in the channel. The containing whitespace is not correct encoded
Expected behavior:
Rocket.Chat encodes the url in the link part of the markdown and replaces the whitespace with an %20 or the url is not encoded by Rocket.Chat and does not replace the % sign with %25
Actual behavior:
If a whitespace is used in the url-part of the markdown link, the whitespace is not encoded by Rocket.Chat webhook. If the whitespace is encoded before by the sender, the Rocket.Chat webhook replaces the % sign again with %25
Server Setup Information:
- Version of Rocket.Chat Server: 3.9.7
- Operating System: linux
- Deployment Method: native
- Number of Running Instances: 1
- DB Replicaset Oplog: activated
- NodeJS Version: v12.18.4
- MongoDB Version: 3.6.14
Client Setup Information
- Desktop App or Browser Version: Desktop App
- Operating System: Windows
Additional context
Relevant logs:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the webhook message with a Markdown link containing a space, then trace the webhook's Markdown URL handling. Compare pre-encoded and unencoded URLs; done means spaces are encoded once and existing percent escapes are not double-encoded.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100