Wrap withinString in try/catch

This commit is contained in:
Pavel Djundik 2017-10-05 23:44:20 +03:00
parent 0d6ff2535e
commit 9a8c1b2fd0

View file

@ -22,6 +22,7 @@ function findLinks(text) {
// <a>-Tags.
// See https://medialize.github.io/URI.js/docs.html#static-withinString
// In our case, we store each URI encountered in a result array.
try {
URI.withinString(text, function(url, start, end) {
let parsedScheme;
@ -57,6 +58,9 @@ function findLinks(text) {
link: url
});
});
} catch (e) {
// withinString is wrapped in a try/catch due to https://github.com/medialize/URI.js/issues/359
}
return result;
}