Skip to content
Myr

fix(utils/ipaddr): do not compress a single 0 group to `::` (#4971)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent c968177 · Browse files · 2 files+6 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Taku Amano <taku@taaas.jp>

Diff stats

2 files+6 added−1 removed

  • tests:+4 added−0 removed
  • other:+2 added−1 removed

2 files+6 added−1 removed

modified:src/utils/ipaddr.test.ts+4 added
modified:src/utils/ipaddr.ts+2 added-1 removed
353 unmodified lines
354 maxZeroStart = currentZeroStart355 maxZeroEnd = 8356 }357 }358 if (maxZeroStart !== -1) {358 // RFC 5952 4.2.2: compress only zero runs of at least two 16-bit fields.359 if (maxZeroStart !== -1 && maxZeroEnd - maxZeroStart > 1) {360 sections.splice(maxZeroStart, maxZeroEnd - maxZeroStart, ':')361 }362363 return sections.join(':').replace(/:{2,}/g, '::')
1 unmodified line