elgs / ip6

IPv6 address helper utilities.
https://ip6.sh
MIT License
20 stars 7 forks source link

Does not invalidate if >4 hex digits is provided within colon set #6

Closed DavidLui closed 3 years ago

DavidLui commented 3 years ago
ipv6.normalize('012345:6800:4003:808::200e'));
Received: "012345:6800:4003:0808:0000:0000:0000:200e"
elgs commented 3 years ago

Thanks @DavidLui, I will add some sanity check.

elgs commented 3 years ago

@DavidLui, this should have been fixed in v0.2.3.

DavidLui commented 3 years ago

Hi elgs,

Reopening to follow up for v.0.2.3, my webpack loader no longer works because of the '?' symbol

image

Can you update ip6 to use the simple check instead?

  if (match?.[0] !== n) {
     throw new Error('Invalid address: ' + a);
  }

to

  if (match && match[0] !== n) {
     throw new Error('Invalid address: ' + a);
  }

Much appreciated.

https://github.com/elgs/ip6/compare/0.2.2...0.2.3#diff-440434714e481098291ea2deb19f62788d2e81e12b39dedabcba6982ead1b827R120

https://github.com/elgs/ip6/compare/0.2.2...0.2.3#diff-ce79cd42290de2bf5e7b2c69b0a45a6466dfb4513f602402eb383054443a59f2R120

elgs commented 3 years ago

Fixed in 0.2.6. Can you please try again? Thanks.

DavidLui commented 3 years ago

Awesome! Appreciate the quick reply. Working now.