fix: support IPv6 addresses in ping monitor

## Changes
- Fixed ping host sanitization regex that stripped everything after
  the first colon, which destroyed IPv6 addresses like 2001:db8::1
- New regex properly handles bracketed IPv6 ([::1]:port), bare IPv6,
  and IPv4/hostname:port formats separately

## Closes
Fixes #3053
This commit is contained in:
gorkem-bwl
2026-03-04 15:41:01 -05:00
parent 189293b04d
commit b2e2b11ef2
@@ -261,7 +261,8 @@ class NetworkService implements INetworkService {
const sanitizedHost = rawUrl
.replace(/^https?:\/\//, "")
.replace(/\/.*$/, "")
.replace(/:.*/, "");
.replace(/^\[(.+)\](?::.*)?$/, "$1") // Extract IPv6 from brackets, strip port
.replace(/^([^[\]:]+):(\d+)$/, "$1"); // Strip port from IPv4/hostname only
const { response, error } = await this.timeRequest(() => this.ping.promise.probe(sanitizedHost));
if (!response) {