From c3134e4c2a9d386ba34517c90e82f41023654733 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 17 Aug 2023 11:32:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=8F=8D=E4=BB=A3=E7=BC=96=E8=BE=91=E6=97=B6=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=20(#1980)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #1976 --- .../website/config/basic/proxy/create/index.vue | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/frontend/src/views/website/website/config/basic/proxy/create/index.vue b/frontend/src/views/website/website/config/basic/proxy/create/index.vue index e4e9878cc..b83c1309b 100644 --- a/frontend/src/views/website/website/config/basic/proxy/create/index.vue +++ b/frontend/src/views/website/website/config/basic/proxy/create/index.vue @@ -234,16 +234,13 @@ const submit = async (formEl: FormInstance | undefined) => { }; const getProtocolAndHost = (url: string): { protocol: string; host: string } | null => { - const regex = /^(https?:\/\/)([^\/]+)/; - const match = url.match(regex); - if (match) { - return { - protocol: match[1], - host: match[2], - }; + if (url.startsWith('https://')) { + return { protocol: 'https', host: url.replaceAll('https://', '') }; } - console.log('err'); - return null; + if (url.startsWith('http://')) { + return { protocol: 'http', host: url.replaceAll('http://', '') }; + } + return { protocol: '', host: url }; }; defineExpose({