Add use of DOMPurify to sanitize text from possible injection

This commit is contained in:
Julie Lenaerts 2023-11-09 19:21:52 +01:00
parent cd793d6842
commit 8363c5c3cf

View File

@ -30,6 +30,8 @@ import { onMounted, ref } from 'vue'
import {makeFetch} from "ChillMainAssets/lib/api/apiMethods";
import Modal from '../../_components/Modal.vue'; // Adjust the import path
import { marked } from 'marked';
import DOMPurify from 'dompurify';
const newsItems = ref([])
@ -59,7 +61,11 @@ const truncateContent = (content, maxLength = 100) => {
};
const convertMarkdownToHtml = (markdown) => {
return marked(markdown);
const rawHtml = marked(markdown);
return rawHtml;
/* console.log('rawhtml', rawHtml)
console.log('sanitized', DOMPurify.sanitize(rawHtml))
return DOMPurify.sanitize(rawHtml)*/
};
const truncateMarkdownContent = (content, maxLength = 100) => {