From 35628960a740e82101888c30bb545e51d3bbc251 Mon Sep 17 00:00:00 2001 From: azure-sea <44580994+azure-sea@users.noreply.github.com> Date: Fri, 29 Aug 2025 17:26:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(acl):=20=E4=BF=AE=E6=AD=A3=20ipRegex=20?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=20IPv4/IPv6=20=E7=9A=84=20CIDR?= =?UTF-8?q?=EF=BC=9B=E8=A1=A5=E9=BD=90=20/128=20=E5=B9=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20IPv4=20/0=E2=80=9332?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原正则表达不支持ipv4/0–32与ipv6/128 例如不支持192.168.1.0/24和ipv6 --- frontend-new/src/pages/Acl/acl.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend-new/src/pages/Acl/acl.jsx b/frontend-new/src/pages/Acl/acl.jsx index c3652eb4..c08ada5b 100644 --- a/frontend-new/src/pages/Acl/acl.jsx +++ b/frontend-new/src/pages/Acl/acl.jsx @@ -48,7 +48,7 @@ const Acl = () => { const {t} = useLanguage(); // 校验IP地址的正则表达式 const ipRegex = - /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){6}[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,1}|(?:[0-9A-Fa-f]{1,4}:){5}[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,2}|(?:[0-9A-Fa-f]{1,4}:){4}[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,3}|(?:[0-9A-Fa-f]{1,4}:){3}[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,4}|(?:[0-9A-Fa-f]{1,4}:){2}[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|(?:[0-9A-Fa-f]{1,4}:){1}[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6}|(?::(?::[0-9A-Fa-f]{1,4}){1,7}|::))(\/(?:12[0-7]|1[0-1][0-9]|[1-9]?[0-9]))?$/; + /^(?:(?:25[0-5]|2[0-4]\d|1?\d\d?)(?:\.(?:25[0-5]|2[0-4]\d|1?\d\d?)){3}(?:\/(?:3[0-2]|[12]?\d))?|(?:(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}|(?:[A-Fa-f0-9]{1,4}:){1,7}:|(?:[A-Fa-f0-9]{1,4}:){1,6}:[A-Fa-f0-9]{1,4}|(?:[A-Fa-f0-9]{1,4}:){1,5}(?::[A-Fa-f0-9]{1,4}){1,2}|(?:[A-Fa-f0-9]{1,4}:){1,4}(?::[A-Fa-f0-9]{1,4}){1,3}|(?:[A-Fa-f0-9]{1,4}:){1,3}(?::[A-Fa-f0-9]{1,4}){1,4}|(?:[A-Fa-f0-9]{1,4}:){1,2}(?::[A-Fa-f0-9]{1,4}){1,5}|[A-Fa-f0-9]{1,4}:(?:(?::[A-Fa-f0-9]{1,4}){1,6})|:(?:(?::[A-Fa-f0-9]{1,4}){1,7}|:))(?:\/(?:12[0-8]|1[01]\d|[1-9]?\d))?)$/ // 支持 IPv4 和 IPv6,包括 CIDR 表示法 // State to store the entire clusterInfo object for easy access const [clusterData, setClusterData] = useState(null);