Skip to content

Commit ebfd792

Browse files
committed
Ignore the pre selector when inlining CSS for incoming emails
This primarily addresses emails generated by Outlook, which can contain thousands of <pre> tags that may cause performance issues. Since the default pre selector typically only defines margins and fonts, ignoring it should generally be acceptable.
1 parent d77e1a7 commit ebfd792

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/RT/Interface/Web/Scrubber.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ sub scrub {
249249

250250
if ( ( length($Content) < ( 1024 * 1024 ) ) && $Content =~ /<style.*>/ ) {
251251
require CSS::Inliner;
252-
my $css_inliner = CSS::Inliner->new( { encode_entities => 1, ignore_style_type_attr => 1 } );
252+
my $css_inliner = CSS::Inliner->new( { encode_entities => 1, ignore_style_type_attr => 1, ignore_selectors => ['pre'] } );
253253
$css_inliner->read( { html => $Content } );
254254
$Content = $css_inliner->inlinify();
255255
}

lib/RT/Transaction.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ sub Content {
381381
} else {
382382
if ( ( length($content) < ( 1024 * 1024 ) ) && $content =~ /<style.*>/ ) {
383383
require CSS::Inliner;
384-
my $css_inliner = CSS::Inliner->new( { encode_entities => 1, ignore_style_type_attr => 1 } );
384+
my $css_inliner = CSS::Inliner->new( { encode_entities => 1, ignore_style_type_attr => 1, ignore_selectors => ['pre'] } );
385385
$css_inliner->read( { html => $content } );
386386
$content = $css_inliner->inlinify();
387387
}

0 commit comments

Comments
 (0)