X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/5de9f9f8e33b1fe8ab69cf38bc58d74cbec81779..490b0f017ff3f88b192444eda0a46eb84bb1c478:/SL/HTML/Util.pm 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}; }