Cleanup email text (#321)

Fix Issue #320
Move split operation to after text cleanup
This commit is contained in:
Shawn Iverson 2018-11-29 12:47:25 -05:00 committed by GitHub
parent be5474b017
commit 6c7a939f44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7571,11 +7571,14 @@ sub DisarmEndtagCallback {
$squashedtext =~ tr/\n/ /; # Join multiple lines onto 1 line
$squashedtext =~ s/(\<\/?[a-z][a-z0-9:._-]*((\s+[a-z][a-z0-9:._-]*(\s*=\s*(?:\".*?\"|\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?\>)*//ig; # Remove tags, better re from snifer_@hotmail.com
$squashedtext =~ s/\s+//g; # Remove any whitespace
if ( $squashedtext =~ /@/ ) {
my @list = split(/@/, $squashedtext);
if ( $DisarmLinkURL =~ m/^ma[il]+to[:;]/i && $squashedtext =~ /@/ ) {
# Remove any leading or trailing text
$squashedtext =~ s/^.*\s+(?=.*\@)//;
$squashedtext =~ s/\s+.*$//;
# Remove &gt; and &lt; tags, if present
# https://github.com/MailScanner/v5/issues/320
$squashedtext =~ s/(?:&lt;|&gt;)//g;
my @list = split(/@/, $squashedtext);
$emailuser = $list[0];
$squashedtext = $list[1]; # Remove username of email addresses
}