fix: limit the prompt template to 1,000 characters
storage.sync rejects any item over 8192 bytes, and the options page writes every field in one set(). An oversized template therefore made every later save fail, including changes to unrelated settings, with only a brief "Could not save settings". Cap the template at 1,000 UTF-16 units: maxlength on the input, and mergeSettings falls back to the default for a longer stored value, as it does for other out-of-range settings. Even a template of pasted control characters (six bytes each once JSON-escaped) stays under the quota; a test pins that arithmetic and another ties the HTML maxlength to the constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,8 +80,8 @@
|
||||
|
||||
<div class="field">
|
||||
<label for="promptTemplate">Prompt template</label>
|
||||
<input type="text" id="promptTemplate" spellcheck="false" />
|
||||
<p class="hint"><code>{query}</code> is replaced with your selected text. Used by Ask normally, Simple mode, the toolbar button, and the keyboard shortcut. Other advanced actions use their own prompts.</p>
|
||||
<input type="text" id="promptTemplate" spellcheck="false" maxlength="1000" />
|
||||
<p class="hint"><code>{query}</code> is replaced with your selected text. Used by Ask normally, Simple mode, the toolbar button, and the keyboard shortcut. Other advanced actions use their own prompts. Up to 1,000 characters.</p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
Reference in New Issue
Block a user