From c9bba819bd73721c098cfa0352bbb47c1265a5d2 Mon Sep 17 00:00:00 2001 From: labbomb <739955946@qq.com> Date: Fri, 6 May 2022 00:08:31 -0700 Subject: [PATCH] [Fix]Added request header validation (#9915) --- dolphinscheduler-ui/src/locales/modules/en_US.ts | 1 + dolphinscheduler-ui/src/locales/modules/zh_CN.ts | 1 + .../src/views/projects/task/components/node/fields/use-http.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/dolphinscheduler-ui/src/locales/modules/en_US.ts b/dolphinscheduler-ui/src/locales/modules/en_US.ts index f61eb95d84..512fe74ae6 100644 --- a/dolphinscheduler-ui/src/locales/modules/en_US.ts +++ b/dolphinscheduler-ui/src/locales/modules/en_US.ts @@ -725,6 +725,7 @@ const project = { task_manager_number_tips: 'Please enter TaskManager number', http_url: 'Http Url', http_url_tips: 'Please Enter Http Url', + http_url_validator: 'The request address must contain HTTP or HTTPS', http_method: 'Http Method', http_parameters: 'Http Parameters', http_check_condition: 'Http Check Condition', diff --git a/dolphinscheduler-ui/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui/src/locales/modules/zh_CN.ts index 260c7e7dbe..7880ff3b50 100644 --- a/dolphinscheduler-ui/src/locales/modules/zh_CN.ts +++ b/dolphinscheduler-ui/src/locales/modules/zh_CN.ts @@ -715,6 +715,7 @@ const project = { task_manager_number_tips: '请输入TaskManager数量', http_url: '请求地址', http_url_tips: '请填写请求地址(必填)', + http_url_validator: '请求地址需包含http或者https', http_method: '请求类型', http_parameters: '请求参数', http_check_condition: '校验条件', diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-http.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-http.ts index 4f3ede7262..a8ff5ebea7 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-http.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-http.ts @@ -55,6 +55,9 @@ export function useHttp(model: { [field: string]: any }): IJsonItem[] { if (!value) { return new Error(t('project.node.http_url_tips')) } + if (value.search(new RegExp('http[s]{0,1}:\/\/([\w.]+\/?)\S*', 'i'))) { + return new Error(t('project.node.http_url_validator')) + } } } },