Enforce 7 bit characters in filenames (#334)

Fix needed to fully resolve https://github.com/MailScanner/v5/issues/233
This commit is contained in:
Shawn Iverson 2018-12-16 11:04:10 -05:00 committed by GitHub
parent dcb5a18ff7
commit 7e89f59321
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -26,8 +26,9 @@ sub output_path {
# Remove any wide characters so that WordDecoder can parse
# no handler was set here, but that's okay, let's play it safe anyway
# https://github.com/MailScanner/v5/issues/253
# Also enforce 7 bit characters in filenames
my $safefilename = $head->recommended_filename;
$safefilename =~ tr/\x00-\xFF/#/c;
$safefilename =~ tr/\x00-\x7F/#/c;
my $fname = mime_to_perl_string $safefilename;

View file

@ -4263,7 +4263,8 @@ sub BuildFile2EntityAndEntity2File {
# Remove any wide characters so that WordDecoder can parse
# mime_to_perl_string is ignoring the built-in handler that was set earlier
# https://github.com/MailScanner/v5/issues/253
$headfile =~ tr/\x00-\xFF/#/c;
# Also enforce 7 bit characters for filenames
$headfile =~ tr/\x00-\x7F/#/c;
$headfile = MIME::WordDecoder::mime_to_perl_string($headfile);
#print STDERR "headfile is $headfile\n";