refac/sec: sanitize note pdf download

This commit is contained in:
Timothy Jaeryang Baek
2025-11-16 19:17:08 -05:00
parent 7c2bed2c73
commit 03cc6ce8eb

View File

@@ -1,3 +1,5 @@
import DOMPurify from 'dompurify';
export const downloadPdf = async (note) => {
const [{ default: jsPDF }, { default: html2canvas }] = await Promise.all([
import('jspdf'),
@@ -9,7 +11,7 @@ export const downloadPdf = async (note) => {
const virtualHeight = 1400; // Fixed height (adjust as needed)
// STEP 1. Get a DOM node to render
const html = note.data?.content?.html ?? '';
const html = DOMPurify.sanitize(note.data?.content?.html ?? '');
const isDarkMode = document.documentElement.classList.contains('dark');
let node;