From 8131ea190860e1f633a3bd009a0c6c5ca1af5ee5 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 13 Jan 2023 16:37:49 +1000 Subject: [PATCH] Fix quotes breaking field descriptions, and prevent content injection https://forums.ankiweb.net/t/some-field-descriptions-are-not-showing/26295 --- ts/editor/NoteEditor.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ts/editor/NoteEditor.svelte b/ts/editor/NoteEditor.svelte index d3ba0f811..da0543417 100644 --- a/ts/editor/NoteEditor.svelte +++ b/ts/editor/NoteEditor.svelte @@ -162,7 +162,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let fieldDescriptions: string[] = []; export function setDescriptions(descriptions: string[]): void { - fieldDescriptions = descriptions; + fieldDescriptions = descriptions.map((d) => + d.replace(/\\/g, "").replace(/"/g, '\\"'), + ); } let fonts: [string, number, boolean][] = [];