fix: 解决容器创建端口选择 ipv6 校验问题 (#1695)

This commit is contained in:
ssongliu 2023-07-17 16:38:21 +08:00 committed by GitHub
parent 22fe2a6d51
commit efebb26b5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -439,12 +439,12 @@ const checkPortValid = () => {
} }
for (const port of dialogData.value.rowData!.exposedPorts) { for (const port of dialogData.value.rowData!.exposedPorts) {
if (port.host.indexOf(':') !== -1) { if (port.host.indexOf(':') !== -1) {
port.hostIP = port.host.split(':')[0]; port.hostIP = port.host.substring(0, port.host.lastIndexOf(':'));
if (checkIpV4V6(port.hostIP)) { if (checkIpV4V6(port.hostIP)) {
MsgError(i18n.global.t('firewall.addressFormatError')); MsgError(i18n.global.t('firewall.addressFormatError'));
return false; return false;
} }
port.hostPort = port.host.split(':')[1]; port.hostPort = port.host.substring(port.host.lastIndexOf(':') + 1);
} else { } else {
port.hostPort = port.host; port.hostPort = port.host;
} }