One of the rooms crashes and freezes the app
Description:
One of the rooms doesn't load messages when scrolling up and crashes for all users. The app freezes and won't let you send messages or switch to another room until it is kicked out of the phone's memory. All the other rooms are unaffected Though on desktop client and web version the room doesn't have any issues. The logs were checked - nothing unusual

Environment Information:
- Rocket.Chat Server Version: 3.5.4 and 3.0.7
- Rocket.Chat App Version: 4.10.0
- OS Version: Android 9, 10 as well as iOS
Steps to reproduce:
The issue is reproducible only in one specific room when opening it on the mobile device and scrolling through the messages
Expected behavior:
The room should load messages in a usual way and the app shouldn't freeze
Actual behavior:
The room doesn't load messages and the app freezes
Note: One unusual thing in this room: it has replies on some messages in a thread a few days later than an initial parent message
Hey, can you reach me on https://open.rocket.chat?
I'm @diego.mello.
Thanks.
The reason for the issue is found: If there are strange very long spaces between URL and text inside the message + this message has the replies - the room crashes and application freezes. The bug is also reported here https://github.com/stiang/remove-markdown/issues/52
UPDATE If any user in the room makes a certain amount of spaces and line breaks in the message, and after that someone replies that message - these actions lead to the crash of the room https://github.com/stiang/remove-markdown/issues/52#issuecomment-682401313
if apply .replace(/\s\s+/g, ' ') before run removeMarkdown then there is no problem
Can you guys open a PR with a fix?
app\containers\message\RepliedThread.js
about line 28
`let msg = shortnameToUnicode(tmsg);
//wx fix strip multiple spaces in message, prvent crash room msg = msg.replace(/\s\s+/g, ' ') //wx fix end
msg = removeMarkdown(msg);` it save room from freez. but when you try to click on reply button it freez again.
just found second place app\containers\markdown\index.js line 387 m = removeMarkdown(m); if apply same fix before that line m = m.replace(/\s\s+/g, ' ')
then everything is ok - no problem with room and jumping into thread
i do not see any more removeMarkdown in the project
It looks like #2446 was created, but it didn't follow the template, nor answered my questions. @johnypeterson @artem-levashov Can you guys provide a way to reproduce this error?
We have faced the problem twice already.
Steps to reproduce:
- From a desktop client or web version send a message which will contain text, a few long spaces, and line breaks
- Reply that message
- From the mobile client open the room and try to scroll over the messages
I can't reproduce it. The PR didn't have a proper test plan, before/after, etc. If you faced twice, how can you be sure it's fixed?
The first time issue was just in the message (without replies), the second time it occurred in a reply flow. We are sure that it's fixed because it was tested manually
We have tested on open.rocket.chat room "test freezing room" - if you come there you will face the problem on mobile
We have now versions of application Master from rocket and fixed version with our pull request. We are facing that problem only on master version. Version with our fix works without any problem. I also put some details in broken room
one_bad_message.txt here is file with bad text that you can copy past after download.
Hey, this is going to be released next Monday. I'm sorry about the delay.