Minor issue with "Add Text Of Doc" feature

Mark Sapiro mark at msapiro.net
Sat May 23 19:21:28 IST 2009


I have installed MailScanner 4.77.5 which adds the charset="utf-8" on
the Content-Type: header and the "-m UTF-8.txt" option to the antiword
command, and all that works well. Thank you for those changes.

I have noticed a couple of things however. I received a message with an
MS-Word attachment named "JALAPENO.DOC". MailScanner added the
text/plain part just fine, but gave it a name "nJALAPENO.DOC". It does
rename the extension from .doc to .txt if the original .doc is lower
case, but not if it is upper or mixed case.

Also, in the case of the above message, MailScanner logged

May 23 10:19:15 sbh16 MailScanner[10908]: Message BEEA26900B9.AF697
added Microsoft Word doc 'JALAPENO.DOC' text as nJALAPENO1.DOC

I.e. the log said it gave the text/plain part the name "nJALAPENO1.DOC"
when in fact, it didn't add the "1" to the name in the delivered

Looking at the code, I don't understand where the "1" in the log
message came from, but the attached Antiword.patch.txt seems to fix
both issues.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
--- MS-4.77.5/MailScanner/Antiword.pm	2009-05-22 01:53:28.000000000 -0700
+++ /usr/lib/MailScanner/MailScanner/Antiword.pm	2009-05-23 11:03:50.000000000 -0700
@@ -109,7 +109,7 @@
   # Create the subdir to unpack it into
   my $unpackfile = $docname;
-  $unpackfile =~ s/\.doc$/.txt$1/;
+  $unpackfile =~ s/\.doc$/.txt$1/i;
   my $attachfile = $unpackfile;
   # Normal attachment so starts with an 'n'.
   $unpackfile = $message->MakeNameSafe('n'.$unpackfile, $dir);

More information about the MailScanner mailing list