Add <ins> and <del> HTML tags to whitelist
This commit is contained in:
parent
0a6ef2b70f
commit
b51d9d09a3
2 changed files with 10 additions and 1 deletions
|
@ -13,7 +13,7 @@ public class HtmlSanitizer {
|
|||
|
||||
HtmlSanitizer() {
|
||||
Whitelist whitelist = Whitelist.relaxed()
|
||||
.addTags("font", "hr")
|
||||
.addTags("font", "hr", "ins", "del")
|
||||
.addAttributes("table", "align", "bgcolor", "border", "cellpadding", "cellspacing", "width")
|
||||
.addAttributes(":all", "class", "style", "id")
|
||||
.addProtocols("img", "src", "http", "https", "cid", "data");
|
||||
|
|
|
@ -167,4 +167,13 @@ public class HtmlSanitizerTest {
|
|||
|
||||
assertEquals("<html><head></head><body>one<hr>two<hr>three</body></html>", toCompactString(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldKeepInsDelTags() {
|
||||
String html = "<html><head></head><body><ins>Inserted</ins><del>Deleted</del></body></html>";
|
||||
|
||||
Document result = htmlSanitizer.sanitize(html);
|
||||
|
||||
assertEquals(html, toCompactString(result));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue