Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Parsing messages with multiple markdown matches ignore some tokens #9884

Merged
merged 2 commits into from
Feb 26, 2018

Conversation

c0dzilla
Copy link
Contributor

@c0dzilla c0dzilla commented Feb 24, 2018

@RocketChat/core

Closes #9854 #9758

The message body was containing a random string of the form '=!=randomInteger=!=' many times whenever the message had multiple markdown matches(for example a url with inline code). This was because the tokens were being unmounted in the order in which they were attached during parsing, leading to misses when a token was overwritten by another token as in the case of mutiple matches. This pr changes unmounting order to LIFO to fix this.

Example:

parse-wrong

now parsed as

parse-correct

@rodrigok
Copy link
Member

Thanks @c0dzilla

What do you think about use reverse to keep the code cleaner?

example:

- for (const {token, text} of message.tokens) {
+ for (const {token, text} of message.tokens.reverse()) {

@c0dzilla
Copy link
Contributor Author

@rodrigok I've made the change.

@rodrigok rodrigok added this to the 0.62.0 milestone Feb 26, 2018
@rodrigok rodrigok changed the title [FIX] Parsing messages with multiple markdown matches [FIX] Parsing messages with multiple markdown matches ignore some tokens Feb 26, 2018
@rodrigok rodrigok merged commit 5033cab into RocketChat:develop Feb 26, 2018
@rodrigok rodrigok mentioned this pull request Feb 28, 2018
@DeanVanGreunen
Copy link

Thanks for fixing Guys 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Big/Small Markdown Display Bug (could contain a great new feature)
4 participants