mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-05 08:10:30 +00:00
refac/sec: sanitize note pdf download
This commit is contained in:
parent
7c2bed2c73
commit
03cc6ce8eb
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue