mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(api): 📦 Change sanitizer from DOMPurify to xss
This commit is contained in:
parent
a430db5c30
commit
154f17ab12
7 changed files with 99 additions and 52 deletions
|
|
@ -555,14 +555,14 @@ export const contentToHtml = async (
|
|||
let htmlContent: string;
|
||||
|
||||
if (content["text/html"]) {
|
||||
htmlContent = content["text/html"].content;
|
||||
htmlContent = await sanitizeHtml(content["text/html"].content);
|
||||
} else if (content["text/markdown"]) {
|
||||
htmlContent = await sanitizeHtml(
|
||||
await markdownParse(content["text/markdown"].content),
|
||||
);
|
||||
} else if (content["text/plain"]?.content) {
|
||||
// Split by newline and add <p> tags
|
||||
htmlContent = content["text/plain"].content
|
||||
htmlContent = (await sanitizeHtml(content["text/plain"].content))
|
||||
.split("\n")
|
||||
.map((line) => `<p>${line}</p>`)
|
||||
.join("\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue