Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: input validate for online debug url #1164

Merged
merged 4 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/src/pages/Route/components/DebugViews/DebugDrawView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ const DebugDrawView: React.FC<RouteModule.DebugDrawProps> = (props) => {
};

const handleDebug = (url: string) => {
if (url === '') {
/* eslint-disable no-useless-escape */
const urlReg = /^(?=^.{3,255}$)(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w*)*(\.\w+)*([\?&]\w+=\w*)*$/;
if (!urlReg.test(url)) {
notification.warning({
message: formatMessage({ id: 'page.route.input.placeholder.requestUrl' }),
});
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Route/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {

'page.route.input.placeholder.parameterNameHttpHeader': 'Request header name, for example: HOST',
'page.route.input.placeholder.parameterNameRequestParameter': 'Parameter name, for example: id',
'page.route.input.placeholder.requestUrl': 'please input the request URL',
'page.route.input.placeholder.requestUrl': 'please input the valid request URL',
'page.route.input.placeholder.paramKey': 'Param Key',
'page.route.input.placeholder.paramValue': 'Param Value',

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Route/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default {
'page.route.input.placeholder.parameterNameHttpHeader': '请求头键名,例如:HOST',
'page.route.input.placeholder.parameterNameRequestParameter': '参数名称,例如:id',
'page.route.input.placeholder.redirectCustom': '例如:/foo/index.html',
'page.route.input.placeholder.requestUrl': '请输入请求地址',
'page.route.input.placeholder.requestUrl': '请输入合法的请求地址',
'page.route.input.placeholder.paramKey': '参数名称',
'page.route.input.placeholder.paramValue': '参数值',
// form
Expand Down