From 2eee0b37b0fcab7f75e8f1b25e6b2cfe3ae272f0 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Mon, 27 May 2024 14:08:11 +0200 Subject: [PATCH] add test for issue #453 use 4.2.0-SNAPSHOT --- pom.xml | 2 +- .../validator/html/test/AntiSamyTest.java | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 49b8869..a06fa30 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ org.htmlunit neko-htmlunit - 4.1.0 + 4.2.0-SNAPSHOT org.slf4j diff --git a/src/test/java/org/owasp/validator/html/test/AntiSamyTest.java b/src/test/java/org/owasp/validator/html/test/AntiSamyTest.java index 21aa664..6af3ce4 100644 --- a/src/test/java/org/owasp/validator/html/test/AntiSamyTest.java +++ b/src/test/java/org/owasp/validator/html/test/AntiSamyTest.java @@ -2666,4 +2666,39 @@ public void testBangCommentsWhenPreservingComments() throws ScanException, Polic .getCleanHTML(), not(containsString("mxss"))); } + + static final String test453 = + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + ""; + + @Test + public void testGithubIssue453() throws ScanException, PolicyException { + String cleaned = as.scan(test453, policy, AntiSamy.SAX).getCleanHTML(); + cleaned = cleaned.replaceAll("\r?\n", ""); + cleaned = cleaned.replaceAll("\\s\\s+", " "); + + assertThat( + cleaned, + containsString(" " + + "
" + + "