Fix quotes breaking field descriptions, and prevent content injection

https://forums.ankiweb.net/t/some-field-descriptions-are-not-showing/26295
This commit is contained in:
Damien Elmes 2023-01-13 16:37:49 +10:00
parent df456e959d
commit 8131ea1908

View File

@ -162,7 +162,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let fieldDescriptions: string[] = []; let fieldDescriptions: string[] = [];
export function setDescriptions(descriptions: string[]): void { export function setDescriptions(descriptions: string[]): void {
fieldDescriptions = descriptions; fieldDescriptions = descriptions.map((d) =>
d.replace(/\\/g, "").replace(/"/g, '\\"'),
);
} }
let fonts: [string, number, boolean][] = []; let fonts: [string, number, boolean][] = [];