Skip to content

Commit 6bf230a

Browse files
committed
fix ipMatch() - unsure when/how it broke!
1 parent 0b71919 commit 6bf230a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

assets/client.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,16 @@ function entityMatch(tag, handle) {
228228
}
229229

230230
function ipMatch(prefix, ip) {
231-
var ip = ipaddr.parse(ip);
232-
var prefix = ipaddr.parseCIDR(prefix);
233-
return (ip.kind() == prefix[0].kind() && ip.match(prefix));
231+
prefix = ipaddr.parseCIDR(prefix);
232+
if (ip.includes("/")) {
233+
ip = ipaddr.parseCIDR(ip);
234+
return (ip[0].kind() == prefix[0].kind() && ip[0].match(prefix));
235+
236+
} else {
237+
ip = ipaddr.parse(ip);
238+
return (ip.kind() == prefix[0].kind() && ip.match(prefix));
239+
240+
}
234241
}
235242

236243
// return the first HTTPS url, or the first URL

0 commit comments

Comments
 (0)