mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: URL encoding parameters not decompiled (#2409)
This commit is contained in:
parent
413fa6f0c2
commit
effe37fa6c
|
|
@ -286,18 +286,42 @@ const checkInputParam = () => {
|
|||
let msg = []
|
||||
for (let f of apiInputFieldList.value) {
|
||||
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]) {
|
||||
msg.push(f.field)
|
||||
}
|
||||
}
|
||||
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 true
|
||||
}
|
||||
const decodeQuery = (query: string) => {
|
||||
try {
|
||||
return decodeURIComponent(query)
|
||||
} catch (e) {
|
||||
return query
|
||||
}
|
||||
}
|
||||
defineExpose({ checkInputParam })
|
||||
onMounted(() => {
|
||||
handleInputFieldList()
|
||||
|
|
|
|||
Loading…
Reference in New Issue