mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-02 02:01:20 +00:00
Sanitize before uploading
This commit is contained in:
@@ -162,8 +162,9 @@ export default function NotesEditor({
|
|||||||
|
|
||||||
const blocks = editor.document;
|
const blocks = editor.document;
|
||||||
const html = editor.blocksToHTMLLossy(blocks);
|
const html = editor.blocksToHTMLLossy(blocks);
|
||||||
|
const cleanHtml = DOMPurify.sanitize(html);
|
||||||
|
|
||||||
// TODO: Sanitize the HTML content before sending to the server (or ensure it's sanitized on the back-end)
|
// Sanitize the HTML content before sending to the server (or ensure it's sanitized on the back-end)
|
||||||
|
|
||||||
if (selectedNote) {
|
if (selectedNote) {
|
||||||
const url = apiUrl(ApiEndpoints.note_list, selectedNote);
|
const url = apiUrl(ApiEndpoints.note_list, selectedNote);
|
||||||
@@ -171,7 +172,7 @@ export default function NotesEditor({
|
|||||||
notifications.hide('note-update-status');
|
notifications.hide('note-update-status');
|
||||||
|
|
||||||
api
|
api
|
||||||
.patch(url, { content: html })
|
.patch(url, { content: cleanHtml })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setIsDirty(false);
|
setIsDirty(false);
|
||||||
notifications.show({
|
notifications.show({
|
||||||
|
|||||||
Reference in New Issue
Block a user