[otrs-cvs] otrs/Kernel/System EmailParser.pm,1.49,1.50

cvs-log at otrs.org cvs-log at otrs.org
Thu Apr 12 23:58:14 GMT 2007


Comments:
Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv14006/Kernel/System

Modified Files:
	EmailParser.pm 
Log Message:
Improved file name handling.

Author: martin

Index: EmailParser.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/EmailParser.pm,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** EmailParser.pm	20 Jan 2007 23:11:34 -0000	1.49
--- EmailParser.pm	12 Apr 2007 23:58:08 -0000	1.50
***************
*** 542,550 ****
          else {
              $PartData{Filename} = decode_mimewords($Part->head()->recommended_filename());
              # convert the file name in utf-8 if utf-8 is used
!             $PartData{Filename} = $Self->{EncodeObject}->Decode(
!                 Text => $PartData{Filename},
!                 From => 'utf-8',
!             );
          }
          # debug
--- 542,562 ----
          else {
              $PartData{Filename} = decode_mimewords($Part->head()->recommended_filename());
+             $PartData{ContentDisposition} = $Part->head()->get('Content-Disposition');
+             if ($PartData{ContentDisposition}) {
+                my %Data = $Self->GetContentTypeParams(ContentType => $PartData{ContentDisposition});
+                if ($Data{Charset}) {
+                    $PartData{Charset} = $Data{Charset};
+                }
+             }
+             else {
+                 $PartData{Charset} = '';
+             }
              # convert the file name in utf-8 if utf-8 is used
!             if ($PartData{Charset}) {
!                 $PartData{Filename} = $Self->{EncodeObject}->Decode(
!                     Text => $PartData{Filename},
!                     From => $PartData{Charset},
!                 );
!             }
          }
          # debug
***************
*** 612,615 ****
--- 624,638 ----
          $Param{Charset} =~ s/(.+?);.*/$1/g;
      }
+     if (!$Param{Charset}) {
+         if ($Param{ContentType} =~ /\?((iso-\d{3,4}-\d{1,2})|(utf-8|utf8))\?/i) {
+             $Param{Charset} = $1;
+         }
+         elsif ($Param{ContentType} =~ /name\*0\*=(utf-8|utf8)/i) {
+             $Param{Charset} = $1;
+         }
+         elsif ($Param{ContentType} =~ /filename\*=((iso-\d{3,4}-\d{1,2})|(utf-8|utf8))''/i) {
+             $Param{Charset} = $1;
+         }
+     }
      if ($Param{ContentType} =~ /^(\w+\/\w+)/i) {
          $Param{MimeType} = $1;
***************
*** 709,711 ****
  $Revision$ $Date$
  
! =cut
\ No newline at end of file
--- 732,734 ----
  $Revision$ $Date$
  
! =cut


More information about the cvs-log mailing list