2 my ($ticket, $trans,$attach, $filename);
3 my $arg = $m->dhandler_arg; # get rest of path
4 if ($arg =~ '^(\d+)/(\d+)') {
9 Abort("Corrupted attachment URL.");
11 my $AttachmentObj = new RT::Attachment($session{'CurrentUser'});
12 $AttachmentObj->Load($attach) || Abort("Attachment '$attach' could not be loaded");
15 unless ($AttachmentObj->id) {
16 Abort("Bad attachment id. Couldn't find attachment '$attach'\n");
18 unless ($AttachmentObj->TransactionId() == $trans ) {
19 Abort("Bad transaction number for attachment. $trans should be".$AttachmentObj->TransactionId() ."\n");
22 my $content_type = $AttachmentObj->ContentType || 'text/plain';
23 SetContentType($content_type);
24 $m->out($AttachmentObj->Content);