Fix XSS vulnerability

Co-authored-by: chbi <chbi@chbi.eu>
This commit is contained in:
Sidharth Vinod
2024-01-15 12:15:57 +05:30
co-authored by chbi
parent 8667c6de33
commit afbc7f3de3
+5 -1
View File
@@ -13,6 +13,7 @@
let container: HTMLDivElement;
let view: HTMLDivElement;
let error = false;
let errorLines: string[] = [];
let outOfSync = false;
let hide = false;
let manualUpdate = true;
@@ -60,6 +61,7 @@
const handleStateChange = async (state: ValidatedState) => {
if (state.error !== undefined) {
error = true;
errorLines = state.error.toString().split('\n');
return;
}
error = false;
@@ -133,7 +135,9 @@
: 'text-yellow-600'} bg-base-100 bg-opacity-80 text-left"
id="errorContainer">
{#if error}
{@html $stateStore.error?.toString().replaceAll('\n', '<br />')}
{#each errorLines as line}
{line}<br />
{/each}
{:else}
Diagram out of sync. <br />
Press <i class="fas fa-sync" /> (Sync button) or <kbd>{cmdKey} + Enter</kbd> to sync.