Trim whitespace before replacing line breaks in unknown elements

34c25300e59b2f77a75cfd3d715c4a13bd9e444f

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +1 -1Showing whitespace changes
public/script.js+1 -1
@@ -379,7 +379,7 @@ DOMPurify.addHook('uponSanitizeElement', (node, _, config) => {
379379
380 // Replace line breaks with <br> in unknown elements380 // Replace line breaks with <br> in unknown elements
381 if (node instanceof HTMLUnknownElement) {381 if (node instanceof HTMLUnknownElement) {
382 node.innerHTML = node.innerHTML.replaceAll('\n', '<br>');382 node.innerHTML = node.innerHTML.trim().replaceAll('\n', '<br>');
383 }383 }
384384
385 const isMediaAllowed = isExternalMediaAllowed();385 const isMediaAllowed = isExternalMediaAllowed();