sanitize htlm

This commit is contained in:
akis committed 2023-01-05 22:41:28 +02:00
1 parent 31ff61e1ae
commit a95b761ce4
3 files changed
+82 -1

No files matched your search

+4 -1
View File
@@ -1,5 +1,6 @@
import type { PageServerLoad } from "./$types";
import { compile } from "mdsvex";
import sanitizeHtml from "sanitize-html";
import db from "$lib/db";
export const load: PageServerLoad = async () => {
@@ -9,10 +10,12 @@ export const load: PageServerLoad = async () => {
return docs.map((doc) => doc.get());
});
const sanitizedContent = sanitizeHtml(data[0].title)
if (data.length !== 0 || data[0] !== undefined) {
return {
announcements: data[0],
content: compile(data[0]["title"]).then((compiled) => compiled?.code)
content: compile(sanitizedContent).then((compiled) => compiled?.code)
}
}
};