1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

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

Refs #1976
This commit is contained in:
ssongliu 2023-08-17 11:32:09 +08:00 committed by wanghe-fit2cloud
parent 23c72c8301
commit 06f81fc7f7

View File

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