Reverse sense of is_not_multipart to is_multipart.
This commit is contained in:
parent
ba3122bd82
commit
3d97773827
@ -323,21 +323,21 @@ sub is_too_big {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub is_not_multipart {
|
||||
sub is_multipart {
|
||||
my $self = shift;
|
||||
my $transaction = shift || $self->qp->transaction;
|
||||
|
||||
return 1 if !$transaction->header;
|
||||
return 0 if !$transaction->header;
|
||||
|
||||
# Ignore non-multipart emails
|
||||
my $content_type = $transaction->header->get('Content-Type') or return 1;
|
||||
my $content_type = $transaction->header->get('Content-Type') or return 0;
|
||||
$content_type =~ s/\s/ /g;
|
||||
if ($content_type !~ m!\bmultipart/.*\bboundary="?([^"]+)!i) {
|
||||
$self->log(LOGNOTICE, "skip, not multipart");
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub should_scan {
|
||||
@ -345,6 +345,6 @@ sub should_scan {
|
||||
my $tran = shift;
|
||||
return 0 if $self->is_too_big($tran);
|
||||
return 1 if $self->{_args}{scan_all};
|
||||
return 0 if $self->is_not_multipart($tran);
|
||||
return 0 if ! $self->is_multipart($tran);
|
||||
return 1;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ sub register_tests {
|
||||
$self->register_test('test_get_filename', 1);
|
||||
$self->register_test('test_set_permission', 1);
|
||||
$self->register_test('test_is_too_big', 2);
|
||||
$self->register_test('test_is_not_multipart', 2);
|
||||
$self->register_test('test_is_multipart', 2);
|
||||
$self->register_test('test_should_scan',4);
|
||||
}
|
||||
|
||||
@ -77,15 +77,15 @@ sub test_is_too_big {
|
||||
ok( $self->is_too_big( $tran ), "is_too_big 2");
|
||||
}
|
||||
|
||||
sub test_is_not_multipart {
|
||||
sub test_is_multipart {
|
||||
my $self = shift;
|
||||
my $tran = Qpsmtpd::Transaction->new();
|
||||
|
||||
ok( $self->is_not_multipart($tran), "not_multipart 1" );
|
||||
ok( ! $self->is_multipart($tran), "is_multipart 1" );
|
||||
$tran->header( Mail::Header->new( [
|
||||
'Content-Type: multipart/alternative; boundary="Jx3Wbb8BMHsO=_?:"'
|
||||
] ) );
|
||||
ok( ! $self->is_not_multipart($tran), "not_multipart 2" );
|
||||
ok( $self->is_multipart($tran), "is_multipart 2" );
|
||||
}
|
||||
|
||||
sub test_should_scan {
|
||||
|
Loading…
Reference in New Issue
Block a user