fix(techdocs): support dompurify 3.2.6

Element.tagName is uppercased, see https://developer.mozilla.org/fr/docs/Web/API/Element/tagName

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
This commit is contained in:
Gabriel Dugny
2025-08-01 14:47:56 +02:00
parent f2c4abfc03
commit 4ce58318da
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
Support Techdocs redirect with dompurify 3.2.6+
@@ -65,7 +65,7 @@ export const useSanitizerTransformer = (): Transformer => {
// Only allow http-equiv and content attributes on meta tags. They are required for the redirect feature.
DOMPurify.addHook('uponSanitizeAttribute', (currNode, data) => {
if (currNode.tagName !== 'meta') {
if (currNode.tagName !== 'META') {
if (data.attrName === 'http-equiv' || data.attrName === 'content') {
currNode.removeAttribute(data.attrName);
}