mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add validation for filter inject argument
This commit is contained in:
@ -1962,6 +1962,10 @@ function injectCallback(args, value) {
|
||||
const filterFunction = args?.filter instanceof SlashCommandClosure ? closureToFilter(args.filter) : null;
|
||||
value = value || '';
|
||||
|
||||
if (args?.filter && !String(filter ?? '').trim()) {
|
||||
throw new Error('Failed to parse the filter argument. Make sure it is a valid non-empty closure.');
|
||||
}
|
||||
|
||||
const prefixedId = `${SCRIPT_PROMPT_KEY}${id}`;
|
||||
|
||||
if (!chat_metadata.script_injects) {
|
||||
|
Reference in New Issue
Block a user