fix: URL encoding parameters not decompiled (#2409)
This commit is contained in:
parent
413fa6f0c2
commit
effe37fa6c
@ -286,18 +286,42 @@ const checkInputParam = () => {
|
|||||||
let msg = []
|
let msg = []
|
||||||
for (let f of apiInputFieldList.value) {
|
for (let f of apiInputFieldList.value) {
|
||||||
if (!api_form_data_context.value[f.field]) {
|
if (!api_form_data_context.value[f.field]) {
|
||||||
api_form_data_context.value[f.field] = route.query[f.field]
|
let _value = route.query[f.field]
|
||||||
|
if (_value != null) {
|
||||||
|
if (_value instanceof Array) {
|
||||||
|
_value = _value
|
||||||
|
.map((item) => {
|
||||||
|
if (item != null) {
|
||||||
|
return decodeQuery(item)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
.filter((item) => item != null)
|
||||||
|
} else {
|
||||||
|
_value = decodeQuery(_value)
|
||||||
|
}
|
||||||
|
api_form_data_context.value[f.field] = _value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (f.required && !api_form_data_context.value[f.field]) {
|
if (f.required && !api_form_data_context.value[f.field]) {
|
||||||
msg.push(f.field)
|
msg.push(f.field)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.length > 0) {
|
if (msg.length > 0) {
|
||||||
MsgWarning(`${t('chat.tip.inputParamMessage1')} ${msg.join('、')}${t('chat.tip.inputParamMessage2')}`)
|
MsgWarning(
|
||||||
|
`${t('chat.tip.inputParamMessage1')} ${msg.join('、')}${t('chat.tip.inputParamMessage2')}`
|
||||||
|
)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
const decodeQuery = (query: string) => {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(query)
|
||||||
|
} catch (e) {
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
}
|
||||||
defineExpose({ checkInputParam })
|
defineExpose({ checkInputParam })
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
handleInputFieldList()
|
handleInputFieldList()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user