From e847d5096d098db1f49d5b0cb3deff90158c1df9 Mon Sep 17 00:00:00 2001 From: RBRi Date: Thu, 6 Jun 2024 16:46:02 +0200 Subject: [PATCH] add test for issue #453 - fix is done in neko (#454) * add test for issue #453 use 4.2.0-SNAPSHOT * code style * add neko-htmlunit snapshot repo * use neko 4.2.0 release * neko-htmlunit version 4.2.1 * remove property --- .../validator/html/test/AntiSamyTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) 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..9669343 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,40 @@ public void testBangCommentsWhenPreservingComments() throws ScanException, Polic .getCleanHTML(), not(containsString("mxss"))); } + + @Test + public void testGithubIssue453() throws ScanException, PolicyException { + String test453 = + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + ""; + String cleaned = as.scan(test453, policy, AntiSamy.SAX).getCleanHTML(); + cleaned = cleaned.replaceAll("\r?\n", ""); + cleaned = cleaned.replaceAll("\\s\\s+", " "); + + assertThat( + cleaned, + containsString( + " " + + "
" + + "