X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FHTML%2FUtil.pm;h=c62fd9202e1c32927ebd32c5dc96e34aaca5161c;hb=0fe023a4ee7e467bfb5f23a87800b8723c8ccacd;hp=0b2e630d00d227829ee6e7835f28489c1bb66a74;hpb=5de9f9f8e33b1fe8ab69cf38bc58d74cbec81779;p=kivitendo-erp.git diff --git a/SL/HTML/Util.pm b/SL/HTML/Util.pm index 0b2e630d0..c62fd9202 100644 --- a/SL/HTML/Util.pm +++ b/SL/HTML/Util.pm @@ -17,6 +17,11 @@ sub strip { my $value = !ref($class_or_value) && (($class_or_value // '') eq 'SL::HTML::Util') ? $_[1] : $class_or_value; + return '' unless defined $value; + + # Remove HTML comments. + $value =~ s{ }{}gx; + if (!%stripper) { %stripper = ( parser => HTML::Parser->new ); @@ -27,7 +32,7 @@ sub strip { $stripper{parser}->parse($value); $stripper{parser}->eof; - $stripper{text} =~ s{\&([^;]+);}{ $entities{$1} }eg; + $stripper{text} =~ s{\&([^;]+);}{ $entities{$1} || "\&$1;" }eg; return delete $stripper{text}; }