MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / validateApiPath

Function validateApiPath

frontend/packages/common/src/utils/validate.ts:28–41  ·  view source on GitHub ↗
(rule, value)

Source from the content-addressed store, hash-verified

26}
27
28export const validateApiPath = (rule, value) => {
29 if (!value) {
30 return Promise.resolve()
31 }
32
33 const invalidCharsRegex = /[^a-zA-Z0-9\-\/\*]/
34 const validPathRegex = /^(\/?\*?\/?[a-zA-Z0-9\-\/\*]*)$/
35
36 if (value && (invalidCharsRegex.test(value.trim()) || !validPathRegex.test(value.trim()))) {
37 return Promise.reject($t('请正确输入路径,如/usr/*或*/usr/*'))
38 }
39
40 return Promise.resolve()
41}

Callers

nothing calls this directly

Calls 1

$tFunction · 0.90

Tested by

no test coverage detected