[Rt-commit] r2115 - in rt/branches/3.4-RELEASE: . lib/RT
jesse at bestpractical.com
jesse at bestpractical.com
Wed Jan 19 17:20:49 EST 2005
Author: jesse
Date: Wed Jan 19 17:20:48 2005
New Revision: 2115
Modified:
rt/branches/3.4-RELEASE/ (props changed)
rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm
Log:
r3892 at hualien: jesse | 2005-01-19T18:38:38.233900Z
Added better error checking for attachment insertion failure. (This unmasked more instances of oracle brokenness)
Modified: rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm (original)
+++ rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm Wed Jan 19 17:20:48 2005
@@ -43,6 +43,7 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
+
=head1 SYNOPSIS
use RT::Attachment;
@@ -165,12 +166,18 @@
# If a message has no bodyhandle, that means that it has subparts (or appears to)
# and we should act accordingly.
unless ( defined $Attachment->bodyhandle ) {
+
$id = $self->SUPER::Create(
TransactionId => $args{'TransactionId'},
Parent => 0,
ContentType => $Attachment->mime_type,
Headers => $Attachment->head->as_string,
Subject => $Subject);
+
+ unless ($id) {
+ $RT::Logger->crit("Attachment insert failed - ".$RT::Handle->dbh->errstr);
+
+ }
foreach my $part ( $Attachment->parts ) {
my $SubAttachment = new RT::Attachment( $self->CurrentUser );
@@ -179,7 +186,6 @@
Parent => $id,
Attachment => $part,
ContentType => $Attachment->mime_type,
- Headers => $Attachment->head->as_string(),
);
}
@@ -189,21 +195,19 @@
#If it's not multipart
else {
-
- my $Body = $Attachment->bodyhandle->as_string;
-
-
my ($ContentEncoding, $Body) = $self->_EncodeLOB($Attachment->bodyhandle->as_string, $Attachment->mime_type);
-
-
my $id = $self->SUPER::Create( TransactionId => $args{'TransactionId'},
ContentType => $Attachment->mime_type,
ContentEncoding => $ContentEncoding,
Parent => $args{'Parent'},
- Headers => $Attachment->head->as_string,
+ Headers => $Attachment->head->as_string,
Subject => $Subject,
Content => $Body,
Filename => $Filename, );
+ unless ($id) {
+ $RT::Logger->crit("Attachment insert failed - ".$RT::Handle->dbh->errstr);
+ }
+
return ($id);
}
}
More information about the Rt-commit
mailing list