diff --git a/frontend/src/lib/components/ContentSearch.svelte b/frontend/src/lib/components/ContentSearch.svelte index 6631f1cebb..0c717b64fe 100644 --- a/frontend/src/lib/components/ContentSearch.svelte +++ b/frontend/src/lib/components/ContentSearch.svelte @@ -64,6 +64,16 @@ function getCounts(n: number) { return ` (${n})` } + + function escape(htmlStr) { + return htmlStr + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') + } + $: counts = search == '' || !scripts || @@ -126,7 +136,7 @@ filter={search} items={apps} f={(s) => { - return YAML.stringify(s.value, null, 4) + return escape(YAML.stringify(s.value, null, 4)) }} bind:filteredItems={filteredAppItems} />