From ce67f3a658f50a169dbbbc032d7e52744ff180e2 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 17 Feb 2025 20:54:11 +0200 Subject: [PATCH] Ensure node is an Element in DOMPurify hook --- public/script.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/script.js b/public/script.js index d42a6c4ab..181e91c80 100644 --- a/public/script.js +++ b/public/script.js @@ -366,6 +366,10 @@ DOMPurify.addHook('uponSanitizeElement', (node, _, config) => { return; } + if (!(node instanceof Element)) { + return; + } + let mediaBlocked = false; switch (node.tagName) {