escape quotes inside quoted option value

This commit is contained in:
LenAnderson 2024-06-25 23:20:24 -04:00
parent 676472f13d
commit aefa31a912
1 changed files with 1 additions and 1 deletions

View File

@ -369,7 +369,7 @@ export class AutoComplete {
// update replacer and add quotes if necessary // update replacer and add quotes if necessary
const optionName = option.valueProvider ? option.valueProvider(this.name) : option.name; const optionName = option.valueProvider ? option.valueProvider(this.name) : option.name;
if (this.effectiveParserResult.canBeQuoted) { if (this.effectiveParserResult.canBeQuoted) {
option.replacer = optionName.includes(' ') || this.startQuote || this.endQuote ? `"${optionName}"` : `${optionName}`; option.replacer = optionName.includes(' ') || this.startQuote || this.endQuote ? `"${optionName.replace(/"/g, '\\"')}"` : `${optionName}`;
} else { } else {
option.replacer = optionName; option.replacer = optionName;
} }