Remove IP addresses from "sneaky" link detection

This commit is contained in:
Evan Hahn 2020-09-29 17:49:28 -05:00 committed by Josh Perez
parent 63b2644cb4
commit 693deaebe8
2 changed files with 13 additions and 21 deletions

View file

@ -1,7 +1,6 @@
/* global URL */
const { isNumber, compact, isEmpty } = require('lodash');
const { isIP } = require('net');
const nodeUrl = require('url');
const LinkifyIt = require('linkify-it');
@ -99,11 +98,6 @@ function isLinkSneaky(link) {
return true;
}
// Domain cannot be an IP address.
if (isIP(domain)) {
return true;
}
// There must be at least 2 domain labels, and none of them can be empty.
const labels = domain.split('.');
if (labels.length < 2 || labels.some(isEmpty)) {