misc: Minor improvements (#1904)

* misc: Minor improvements

* Update legacy-changes.txt

* Update composer.lock
This commit is contained in:
Roman Kelesidis 2025-05-07 22:26:51 +03:00 committed by GitHub
commit 3cdf843a04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 12 deletions

View file

@ -605,11 +605,14 @@ function bt_show_ip($ip, $port = '')
if (IS_AM) {
$ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($ip);
// Wrap IPv6 address in square brackets
if ($port && str_contains($ip, ':')) {
$ip = "[$ip]";
if (!empty($port)) {
if (\TorrentPier\Helpers\IPHelper::isValidv6($ip)) {
// Wrap IPv6 address in square brackets
$ip = "[$ip]:$port";
} else {
$ip = "$ip:$port";
}
}
$ip .= $port ? ":$port" : '';
return $ip;
}