From 0954d7dfc7d3a776bb3e7a5039c85015b8837c90 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 8 Sep 2022 14:23:47 +0200 Subject: Fix it_html::sanitize with nested tags --- it_html.class | 2 +- test/it_html.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/it_html.class b/it_html.class index 913d018..5a2fb68 100644 --- a/it_html.class +++ b/it_html.class @@ -409,7 +409,7 @@ static function sanitize($html) $html = it::replace(array('[\0\s]+' => " "), $html); # \s also matches \r and \n $urlpattern = 'https?://[^">]+'; - if ($tag = it::match("(.*)<(div|p|i|b|strong|h[1-6])\b[^>]*>(.*?)\\2>(.*)", $html)) + if ($tag = it::match("(.*?)<(div|p|i|b|strong|h[1-6])\b[^>]*>(.*?)\\2>(.*)", $html)) { # Simple tags with content, no attributes kept list($head, $tagname, $content, $tail) = $tag; diff --git a/test/it_html.t b/test/it_html.t index aa734c0..ae11ad1 100755 --- a/test/it_html.t +++ b/test/it_html.t @@ -225,7 +225,7 @@ is(
'), - ' swisspics posted < < ä & yesterday a photo tag missmatch:swisspics posted < < ä & yesterday a photo tag missmatch: