Skip to content

Commit a8d96fd

Browse files
committed
Content filter: Allowed custom diagram attribute in allow-list
For #6026
1 parent 9d15c79 commit a8d96fd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/Util/ConfiguredHtmlPurifier.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ public function configureDefinition(HTMLPurifier_HTMLDefinition $definition): vo
134134
'value' => 'Text',
135135
]
136136
);
137+
138+
// Allow the drawio-diagram attribute on div elements
139+
$definition->addAttribute(
140+
'div',
141+
'drawio-diagram',
142+
'Number',
143+
);
137144
}
138145

139146
public function purify(string $html): string

tests/Entity/PageContentFilteringTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ public function test_allow_list_style_filtering()
463463
'<div style="position:absolute;left:0;color:#00FFEE;">Hello!</div>' => '<div style="color:#00FFEE;">Hello!</div>',
464464
'<div style="background:#FF0000;left:0;color:#00FFEE;">Hello!</div>' => '<div style="background:#FF0000;color:#00FFEE;">Hello!</div>',
465465
'<div style="color:#00FFEE;">Hello!<style>testinghello!</style></div>' => '<div style="color:#00FFEE;">Hello!</div>',
466+
'<div drawio-diagram="5332" another-attr="cat">Hello!</div>' => '<div drawio-diagram="5332">Hello!</div>',
466467
];
467468

468469
config()->set('app.content_filtering', 'a');

0 commit comments

Comments
 (0)