From 76b67cb889700cbfa1c0a35bd97e46c6090b5c5e Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Thu, 12 Jan 2023 11:28:11 -0700 Subject: [PATCH] ui: fix IPv6 formatting logic --- resources/scripts/lib/formatters.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/scripts/lib/formatters.ts b/resources/scripts/lib/formatters.ts index 66e4ea646..c15cc3d6b 100644 --- a/resources/scripts/lib/formatters.ts +++ b/resources/scripts/lib/formatters.ts @@ -8,7 +8,7 @@ function mbToBytes(megabytes: number): number { } /** - * Given an amount of bytes, converts them into a human readable string format + * Given an amount of bytes, converts them into a human-readable string format * using "1024" as the divisor. */ function bytesToString(bytes: number, decimals = 2): string { @@ -28,7 +28,7 @@ function bytesToString(bytes: number, decimals = 2): string { */ function ip(value: string): string { // noinspection RegExpSimplifiable - return /([a-f0-9:]+:+)+[a-f0-9]+/.test(value) ? `[${value}]` : value; + return /^([a-f0-9:]+:+)+[a-f0-9]+$/.test(value) ? `[${value}]` : value; } export { ip, mbToBytes, bytesToString };