mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-23 16:01:21 +02:00
test: fix test if ip is invalid
This commit is contained in:
@@ -49,6 +49,10 @@ Blacklist.test = async function (clientIp) {
|
|||||||
}
|
}
|
||||||
clientIp = clientIp.split(':').length === 2 ? clientIp.split(':')[0] : clientIp;
|
clientIp = clientIp.split(':').length === 2 ? clientIp.split(':')[0] : clientIp;
|
||||||
|
|
||||||
|
if (!validator.isIP(clientIp)) {
|
||||||
|
throw new Error('[[error:invalid-ip]]');
|
||||||
|
}
|
||||||
|
|
||||||
const rules = Blacklist._rules;
|
const rules = Blacklist._rules;
|
||||||
function checkCidrRange(clientIP) {
|
function checkCidrRange(clientIP) {
|
||||||
if (!rules.cidr.length) {
|
if (!rules.cidr.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user