Enable linkify in the Log component#873
Conversation
Convert URLs to clickable links by setting the `linkify` prop on ansi-to-react.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Megan-Wright
left a comment
There was a problem hiding this comment.
@AlanGreene Adam asked me to have a look at this since he's pretty busy.... code looks ok but tested out your branch and a link in the logs to github.ibm.com took me to this address:
....so not sure it's working as intended? Thoughts?
|
hrmm that's definitely unexpected... can you share the raw log content (i.e. from the API response)? |
|
@AlanGreene |
|
@Megan-Wright can you provide the raw log content (or a stripped down version showing the affected lines) where you're seeing this issue? i.e. the response to |
|
Thanks for providing the logs @Megan-Wright, they confirmed my suspicions. When using ansi-to-react with the Looking at the ansi-to-react code, it appears they're doing the link parsing themselves rather than using a well-tested library such as https://www.npmjs.com/package/linkify-it. They're using a regex and some simple string splitting to attempt to extract URLs. Even with support for non-whitespace surround chars this results in a less than ideal outcome. I've tested a number of samples that break when using the current Closing this PR for now, but I'll try to put together a prototype using linkify-it in ansi-to-react instead of their current approach to confirm it works and passes their existing tests. Once we have that we can see if it's something they'd be willing to accept as a PR, or if we need to fork / look for an alternative. |


Changes
Convert URLs to clickable links by setting the
linkifypropon ansi-to-react.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide
for more details.