[Rt-commit] r6860 - in rt/branches/3.7-EXPERIMENTAL-RTIR-2.2: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Jan 26 14:27:34 EST 2007


Author: ruz
Date: Fri Jan 26 14:27:33 2007
New Revision: 6860

Modified:
   rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm

Log:
 r4440 at cubic-pc (orig r6811):  jesse | 2007-01-26 15:21:23 +0300
  r21377 at hualien:  jesse | 2007-01-26 20:20:50 +0800
  * Switch web-form based email attachments to in-core storage for better persistence across http hits
 


Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Interface/Web.pm	Fri Jan 26 14:27:33 2007
@@ -644,25 +644,9 @@
 
     if (my $filehandle = $cgi_object->upload( $args{'AttachmentFieldName'} ) ) {
 
-
-
-    use File::Temp qw(tempfile tempdir);
-
-    #foreach my $filehandle (@filenames) {
-
-    my ( $fh, $temp_file );
-    for ( 1 .. 10 ) {
-        # on NFS and NTFS, it is possible that tempfile() conflicts
-        # with other processes, causing a race condition. we try to
-        # accommodate this by pausing and retrying.
-        last if ($fh, $temp_file) = eval { tempfile( UNLINK => 1) };
-        sleep 1;
-    }
-
-    binmode $fh;    #thank you, windows
-    my ($buffer);
+    my (@content,$buffer);
     while ( my $bytesread = read( $filehandle, $buffer, 4096 ) ) {
-        print $fh $buffer;
+        push @content, $buffer;
     }
 
     my $uploadinfo = $cgi_object->uploadInfo($filehandle);
@@ -673,12 +657,13 @@
                    
     $filename =~ s#^.*[\\/]##;
 
+
+    
     $Message->attach(
-        Path     => $temp_file,
+        Data    => \@content,
         Filename => Encode::decode_utf8($filename),
         Type     => $uploadinfo->{'Content-Type'},
     );
-    close($fh);
 
     #   }
 


More information about the Rt-commit mailing list