[Rt-commit] rt branch, 4.4/rescue-outlook-html, updated. rt-4.4.3-59-gfe333a296
Gergely Nagy
algernon at bestpractical.com
Tue Nov 6 07:47:07 EST 2018
The branch, 4.4/rescue-outlook-html has been updated
via fe333a2969515f669b85700ed2a015a4083cb943 (commit)
from 99405a54527089c93f9da084cf989a468be09cde (commit)
Summary of changes:
lib/RT/EmailParser.pm | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
- Log -----------------------------------------------------------------
commit fe333a2969515f669b85700ed2a015a4083cb943
Author: Gergely Nagy <algernon at bestpractical.com>
Date: Tue Nov 6 13:46:03 2018 +0100
Code cleanup in RescueOutlook
Instead of using three separate substitution steps, use just one with three big
groups and /x for readable code.
diff --git a/lib/RT/EmailParser.pm b/lib/RT/EmailParser.pm
index 5d9ae4c56..94e3c0325 100644
--- a/lib/RT/EmailParser.pm
+++ b/lib/RT/EmailParser.pm
@@ -709,13 +709,11 @@ sub RescueOutlook {
# use the unencoded string
my $html_content = $html_part->bodyhandle->as_string;
- my $changed;
-
- $changed = $html_content =~ s{<p(\s+style="[^"]*")?>(<br>)?\n?</p>}{}mg;
- $changed |= $html_content =~ s{<div><br>\n?</div>}{}mg;
- $changed |= $html_content =~ s{<p(\s+[^>]+)?><span(\s+[^>]+)?><o:p> </o:p></span></p>}{}mg;
-
- if ( $changed ) {
+ if ( $html_content =~ s{
+ (<p(\s+style="[^"]*")?>(<br>)?\n?</p>)|
+ (<div><br>\n?</div>)|
+ (<p(\s+[^>]+)?><span(\s+[^>]+)?><o:p> </o:p></span></p>)
+ } {}xmg ) {
# only write only if we did change the content
if ( my $io = $html_part->open("w") ) {
$io->print($html_content);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list