Skip to content

Commit fee4cba

Browse files
gui: Fix proxy details display in Options Dialog
- Ensured that the proxy IP is displayed correctly in the UI when using an IPv6 address. No functionality impact; changes only affect UI display.
1 parent 0c4ff18 commit fee4cba

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/qt/optionsmodel.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,15 @@ static ProxySetting ParseProxyString(const QString& proxy)
320320
if (proxy.isEmpty()) {
321321
return default_val;
322322
}
323-
// contains IP at index 0 and port at index 1
324-
QStringList ip_port = GUIUtil::SplitSkipEmptyParts(proxy, ":");
325-
if (ip_port.size() == 2) {
326-
return {true, ip_port.at(0), ip_port.at(1)};
323+
uint16_t port{0};
324+
std::string hostname;
325+
if (SplitHostPort(proxy.toStdString(), port, hostname) && port != 0) {
326+
// Valid and port within the valid range
327+
// Check if the hostname contains a colon, indicating an IPv6 address
328+
if (hostname.find(':') != std::string::npos) {
329+
hostname = "[" + hostname + "]"; // Wrap IPv6 address in brackets
330+
}
331+
return {true, QString::fromStdString(hostname), QString::number(port)};
327332
} else { // Invalid: return default
328333
return default_val;
329334
}

0 commit comments

Comments
 (0)