fix: addressed link detection issue (#2660)

This commit is contained in:
Wyatt Johnson
2019-10-22 10:34:32 -04:00
committed by Kim Gardner
parent 13853ef87e
commit c9381c6367
2 changed files with 7 additions and 10 deletions
@@ -1,8 +0,0 @@
import LinkifyIt from 'linkify-it';
import tlds from 'tlds';
export function createLinkify() {
const linkify = new LinkifyIt();
linkify.tlds(tlds);
return linkify;
}
+7 -2
View File
@@ -1,4 +1,4 @@
const linkify = require('linkify-it')().tlds(require('tlds'));
const linkify = require('linkifyjs');
// This phase checks the comment if it has any links in it if the check is
// enabled.
@@ -11,7 +11,12 @@ module.exports = (
},
}
) => {
if (premodLinksEnable && linkify.test(comment.body.replace(/\xAD/g, ''))) {
if (premodLinksEnable) {
const links = linkify.find(comment.body.replace(/\xAD/g, ''));
if (!links || links.length === 0) {
return;
}
// Add the flag related to Trust to the comment.
return {
status: 'SYSTEM_WITHHELD',