From 3bf80a53cc11432d1b2d3dce51f26a165c20c87e Mon Sep 17 00:00:00 2001 From: Varnika Bagaria Date: Thu, 20 Oct 2022 16:17:52 +0530 Subject: [PATCH 1/2] [Varnika|Yashna] Fix. IPv6 format is fixed --- src/lib/isIP.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isIP.js b/src/lib/isIP.js index 40ca19aec..93c89dbbc 100644 --- a/src/lib/isIP.js +++ b/src/lib/isIP.js @@ -42,7 +42,7 @@ const IPv6AddressRegExp = new RegExp('^(' + `(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` + `(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` + `(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` + - ')(%[0-9a-zA-Z-.:]{1,})?$'); + ')(%[0-9a-zA-Z.]{1,})?$'); export default function isIP(str, version = '') { assertString(str); From 36b555c4695ae138560d79e950193d5fbb5037d6 Mon Sep 17 00:00:00 2001 From: Varnika Bagaria <55554547+VarnikaB@users.noreply.github.com> Date: Mon, 24 Oct 2022 08:13:57 +0530 Subject: [PATCH 2/2] Added the invalid test Cases for IPv6 --- test/validators.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/validators.js b/test/validators.js index c0e36bec7..05eff918c 100644 --- a/test/validators.js +++ b/test/validators.js @@ -1082,6 +1082,8 @@ describe('Validators', () => { '2001:db8:0000:1:1:1:1::1', '0:0:0:0:0:0:ffff:127.0.0.1', '0:0:0:0:ffff:127.0.0.1', + 'BC:e4d5:c:e7b9::%40i0nccymtl9cwfKo.5vaeXLSGRMe:EDh2qs5wkhnPws5xQKqafjfAMm6wGFCJ.bVFsZfb', + '1dC:0DF8:62D:3AC::%KTatXocjaFVioS0RTNQl4mA.V151o0RSy.JIu-D-D8.d3171ZWsSJ7PK4YjkJCRN0F', ], }); test({