diff options
Diffstat (limited to 'cli/js/web/url.ts')
-rw-r--r-- | cli/js/web/url.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts index f466f9583..fabef3329 100644 --- a/cli/js/web/url.ts +++ b/cli/js/web/url.ts @@ -565,7 +565,8 @@ function encodeHostname(s: string, isSpecial = true): string { if (!s.match(/^\[[0-9A-Fa-f.:]{2,}\]$/)) { throw new TypeError("Invalid hostname."); } - return s.toLowerCase(); + // IPv6 address compress + return s.toLowerCase().replace(/\b:?(?:0+:?){2,}/, "::"); } let result = s; |