Show ipv6 with correct in-url syntax (#3776)

This commit is contained in:
Patrick R 2021-12-04 19:35:55 +01:00 committed by GitHub
parent e8e2911a92
commit 622b939f00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 10 deletions

View file

@ -63,3 +63,7 @@ export function encodePathSegments (path: string): string {
export function hashToPath (hash: string): string {
return hash.length > 0 ? decodeURIComponent(hash.substr(1)) : '/';
}
export function formatIp (ip: string): string {
return /([a-f0-9:]+:+)+[a-f0-9]+/.test(ip) ? `[${ip}]` : ip;
}