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(message-parser): Link parser issues #962

Merged
merged 3 commits into from
Feb 2, 2023
Merged

fix(message-parser): Link parser issues #962

merged 3 commits into from
Feb 2, 2023

Conversation

hugocostadev
Copy link
Contributor

@hugocostadev hugocostadev commented Jan 24, 2023

Proposed changes (including videos or screenshots)

I've done several changes to grammar.pegjs to improve the link parser, such as:

  • Added a library called tldts that validates if it's a valid TLD (Top-Layer-Domain) this fixed several texts dat had a dot between and that was not a link to become a link
  • Fixed some special chars like : -, _ and others to be accepted in the link
  • Removed the digit restriction to start the domain or TLD
  • Removed last comma or dot that follows an URL to be parsed as a part of the LINK.

Previous result:
image

Current Results (NEW) :
image

Benchmark results

develop branch (current parser)
image

this PR (proposed parser)
image

Issue(s)

RocketChat/Rocket.Chat#27376
RocketChat/Rocket.Chat#27484
RocketChat/Rocket.Chat#26476
RocketChat/Rocket.Chat#27078

Further comments

TC-294

@hugocostadev hugocostadev requested a review from ggazzo January 25, 2023 11:34
@ggazzo ggazzo merged commit 3377d6b into develop Feb 2, 2023
@ggazzo ggazzo deleted the fix/links branch February 2, 2023 18:10
@Matt-something
Copy link

You're lacking any testing for single word domains using DNS to resolve back to an IP

https://singleword/directory/word should be recognised as a URL

@alvaropmello alvaropmello added this to the 6.0.0 milestone Feb 14, 2023
@hugocostadev
Copy link
Contributor Author

You're lacking any testing for single word domains using DNS to resolve back to an IP

https://singleword/directory/word should be recognised as a URL

Meanwhile you can use as this [https://singleword/directory/word](https://singleword/directory/word) , we accepts file path (the pattern of this link) inside the reference link

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.

4 participants