-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Labels
Description
I use the library to detect, in messages, URLs used to scam people. However, today, the detection failed on a message due to an invalid library detection preventing a parse by nodejs' native URL library
Code
function findURLs(text: string): URL[] {
return linkify.find(text, "url")
.map( l => new URL(l.href) );
}
const messageWithTwoUrls = "[https://store.steampowered.com](https://u.com/aig)"
const res = findURLs(messageWithTwoUrls) // <- error thrown by new URLUrl detected
[{
"type": "url",
"value": "https://store.steampowered.com](https://u.com/aig)",
"isLink": true,
"href": "https://store.steampowered.com](https://u.com/aig)"
}]Expected
[{
"type": "url",
"value": "https://store.steampowered.com",
"isLink": true,
"href": "https://store.steampowered.com"
},{
"type": "url",
"value": "https://u.com/aig",
"isLink": true,
"href": "https://u.com/aig"
}]