mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-05 07:19:49 +00:00
Add use of DOMPurify to sanitize text from possible injection
This commit is contained in:
parent
997a6ea419
commit
fc22bf1194
@ -30,6 +30,8 @@ import { onMounted, ref } from 'vue'
|
|||||||
import {makeFetch} from "ChillMainAssets/lib/api/apiMethods";
|
import {makeFetch} from "ChillMainAssets/lib/api/apiMethods";
|
||||||
import Modal from '../../_components/Modal.vue'; // Adjust the import path
|
import Modal from '../../_components/Modal.vue'; // Adjust the import path
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
|
import DOMPurify from 'dompurify';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const newsItems = ref([])
|
const newsItems = ref([])
|
||||||
@ -59,7 +61,11 @@ const truncateContent = (content, maxLength = 100) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const convertMarkdownToHtml = (markdown) => {
|
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) => {
|
const truncateMarkdownContent = (content, maxLength = 100) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user