Skip to content

Commit effe37f

Browse files
authored
fix: URL encoding parameters not decompiled (#2409)
1 parent 413fa6f commit effe37f

File tree

1 file changed

+26
-2
lines changed
  • ui/src/components/ai-chat/component/user-form

1 file changed

+26
-2
lines changed

ui/src/components/ai-chat/component/user-form/index.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,42 @@ const checkInputParam = () => {
286286
let msg = []
287287
for (let f of apiInputFieldList.value) {
288288
if (!api_form_data_context.value[f.field]) {
289-
api_form_data_context.value[f.field] = route.query[f.field]
289+
let _value = route.query[f.field]
290+
if (_value != null) {
291+
if (_value instanceof Array) {
292+
_value = _value
293+
.map((item) => {
294+
if (item != null) {
295+
return decodeQuery(item)
296+
}
297+
return null
298+
})
299+
.filter((item) => item != null)
300+
} else {
301+
_value = decodeQuery(_value)
302+
}
303+
api_form_data_context.value[f.field] = _value
304+
}
290305
}
291306
if (f.required && !api_form_data_context.value[f.field]) {
292307
msg.push(f.field)
293308
}
294309
}
295310
if (msg.length > 0) {
296-
MsgWarning(`${t('chat.tip.inputParamMessage1')} ${msg.join('')}${t('chat.tip.inputParamMessage2')}`)
311+
MsgWarning(
312+
`${t('chat.tip.inputParamMessage1')} ${msg.join('')}${t('chat.tip.inputParamMessage2')}`
313+
)
297314
return false
298315
}
299316
return true
300317
}
318+
const decodeQuery = (query: string) => {
319+
try {
320+
return decodeURIComponent(query)
321+
} catch (e) {
322+
return query
323+
}
324+
}
301325
defineExpose({ checkInputParam })
302326
onMounted(() => {
303327
handleInputFieldList()

0 commit comments

Comments
 (0)