Skip to content

Commit c3134e4

Browse files
authored
fix: 解决网站反代编辑时回显错误的问题 (#1980)
Refs #1976
1 parent bdd36b3 commit c3134e4

File tree

1 file changed

+6
-9
lines changed
  • frontend/src/views/website/website/config/basic/proxy/create

1 file changed

+6
-9
lines changed

frontend/src/views/website/website/config/basic/proxy/create/index.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,13 @@ const submit = async (formEl: FormInstance | undefined) => {
234234
};
235235
236236
const getProtocolAndHost = (url: string): { protocol: string; host: string } | null => {
237-
const regex = /^(https?:\/\/)([^\/]+)/;
238-
const match = url.match(regex);
239-
if (match) {
240-
return {
241-
protocol: match[1],
242-
host: match[2],
243-
};
237+
if (url.startsWith('https://')) {
238+
return { protocol: 'https', host: url.replaceAll('https://', '') };
244239
}
245-
console.log('err');
246-
return null;
240+
if (url.startsWith('http://')) {
241+
return { protocol: 'http', host: url.replaceAll('http://', '') };
242+
}
243+
return { protocol: '', host: url };
247244
};
248245
249246
defineExpose({

0 commit comments

Comments
 (0)