From 8668d2edbc621a7c0974ff3a93c791870403d74c Mon Sep 17 00:00:00 2001 From: AAfghahi <48933336+AAfghahi@users.noreply.github.com> Date: Mon, 23 Aug 2021 16:54:25 -0400 Subject: [PATCH] fix: regex for multi-region IPs (#16410) * regex for multi-region IPs * Update index.tsx --- .../src/views/CRUD/data/database/DatabaseModal/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 77f6109db52a9..55bceb7369570 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -853,8 +853,9 @@ const DatabaseModal: FunctionComponent = ({ const { hostname } = window.location; let ipAlert = connectionAlert?.REGIONAL_IPS?.default || ''; const regionalIPs = connectionAlert?.REGIONAL_IPS || {}; - Object.entries(regionalIPs).forEach(([regex, ipRange]) => { - if (regex.match(hostname)) { + Object.entries(regionalIPs).forEach(([ipRegion, ipRange]) => { + const regex = new RegExp(ipRegion); + if (hostname.match(regex)) { ipAlert = ipRange; } });