fast-uri icon indicating copy to clipboard operation
fast-uri copied to clipboard

bug: normalizeIPv6 does not normalize correct when double colon is already added

Open Uzlopak opened this issue 1 year ago • 0 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the issue has not already been raised

Issue

normalizeIPv6 in utils can not properly normalize IPv6 addresses. Hard to describe, so here an example:

::0000:1 has to be normalized to ::1 but it is normalized to :::1 1::1:0:0:1has to be normalized to 1::1:0:0:1but is normalized to 1::1:::1

So basically in the normalizeIPv6 function we have to track if we already added the double colon, and if so, dont add again a double colon. Also if we have added a double colon following hextets with 0 need to be written out.

In #88 I modified already the stringArrayToHexStripped I added a second parameter called keepZero. So if we already added a double colon followed by a non-zero hextet, we have to track to keep the zero and if we have following 0 hextets we have to set in stringArrayToHexStripped the parameter keepZero to true.

Uzlopak avatar Jun 14 '24 01:06 Uzlopak