Browse Source

fix: 解决网站反代编辑时回显错误的问题 (#1980)

Refs #1976
pull/1986/head
ssongliu 1 year ago committed by GitHub
parent
commit
c3134e4c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      frontend/src/views/website/website/config/basic/proxy/create/index.vue

15
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({

Loading…
Cancel
Save