[Rt-commit] r6811 - in rt/branches/3.6-RELEASE: .
jesse at bestpractical.com
jesse at bestpractical.com
Fri Jan 26 07:21:27 EST 2007
Author: jesse
Date: Fri Jan 26 07:21:23 2007
New Revision: 6811
Modified:
rt/branches/3.6-RELEASE/ (props changed)
rt/branches/3.6-RELEASE/lib/RT/Interface/Web.pm
Log:
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.6-RELEASE/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.6-RELEASE/lib/RT/Interface/Web.pm Fri Jan 26 07:21:23 2007
@@ -634,25 +634,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);
@@ -663,12 +647,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