Mark mime-types with invalid characters as "invalid/type". Thanks to gitdevmod for the report.

This commit is contained in:
Darold Gilles 2016-01-27 22:54:51 +01:00
parent a3d7c87a60
commit 06a01f5141
1 changed files with 6 additions and 2 deletions

View File

@ -1239,7 +1239,9 @@ sub _parse_file_part
$time = timegm_nocheck($6, $5, $4, $1, $month_number{$2} - 1, $3 - 1900) + $tz;
}
# Some site has corrupted mime_type, try to remove nasty characters
$mime_type =~ s/[^\-\/\.\(\)\+\_,\=a-z0-9]+//igs;
if ($mime_type =~ s/[^\-\/\.\(\)\+\_,\=a-z0-9]+//igs) {
$mime_type = 'invalide/type';
}
} elsif ($line =~ $sg_format_regex1) {
$format = 'squidguard';
$self->{is_squidguard_log} = 1;
@ -1342,7 +1344,9 @@ sub _parse_file_part
$status = lc($3);
$mime_type = lc($4);
# Some site has corrupted mime_type, try to remove nasty characters
$mime_type =~ s/[^\-\/\.\(\)\+\_,\=a-z0-9]+//igs;
if ($mime_type =~ s/[^\-\/\.\(\)\+\_,\=a-z0-9]+//igs) {
$mime_type = 'invalide/type';
}
}
if ($url) {