Skip to content

Fix to remove trailing parenthesis from parsed Link #79

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

Merged

Conversation

rapsealk
Copy link
Contributor

Hello react-logviewer!

While trying to parse a Link wrapped in parentheses, I found that the trailing parenthesis ramains in the result.

For example, when I tried to parse "(https://example.com)", it resulted in ["(", "https://example.com)"], which does not seem to be a valid URL.

Therefore, this pull request patches parseLinks() to consider trailing parenthesis, as well as starting parenthesis.

Refs

--- Generated by copilot below ---

This pull request includes changes to the link parsing functionality in the src/components/Utils/utils.ts file and corresponding tests in the src/components/Utils/utils.test.ts file. The changes improve the handling of links wrapped in parentheses and ensure more accurate parsing of such links.

Improvements to link parsing:

  • src/components/Utils/utils.ts: Updated the parseLinks function to handle links wrapped in parentheses by splitting tokens using a more precise regular expression and processing each part accordingly.

Testing enhancements:

  • src/components/Utils/utils.test.ts: Added new test cases to verify the correct parsing of links wrapped in parentheses, links starting with a parenthesis, and links with a trailing parenthesis.

@melloware melloware added the bug Something isn't working label Jan 14, 2025
@melloware melloware modified the milestones: 5.3.2, 6.1.1, 6.1.2 Jan 14, 2025
Copy link
Owner

@melloware melloware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent job @rapsealk

@melloware melloware merged commit 63c8418 into melloware:main Jan 14, 2025
@melloware
Copy link
Owner

6.1.2 is in NPM now

@rapsealk rapsealk deleted the fix/strip-parentheses-from-link-token branch January 14, 2025 14:18
@rapsealk
Copy link
Contributor Author

Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants