diff options
author | ivan <ivan> | 2002-08-12 06:17:09 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-08-12 06:17:09 +0000 |
commit | 3ef62a0570055da710328937e7f65dbb2c027c62 (patch) | |
tree | d549158b172fd499b4f81a2981b62aabbde4f99b /rt/webrt/SelfService/Attachment/dhandler | |
parent | 030438c9cb1c12ccb79130979ef0922097b4311a (diff) |
import rt 2.0.14
Diffstat (limited to 'rt/webrt/SelfService/Attachment/dhandler')
-rw-r--r-- | rt/webrt/SelfService/Attachment/dhandler | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rt/webrt/SelfService/Attachment/dhandler b/rt/webrt/SelfService/Attachment/dhandler new file mode 100644 index 000000000..0d646cc0b --- /dev/null +++ b/rt/webrt/SelfService/Attachment/dhandler @@ -0,0 +1,27 @@ +<%perl> + my ($ticket, $trans,$attach, $filename); + my $arg = $m->dhandler_arg; # get rest of path + if ($arg =~ '^(\d+)/(\d+)') { + $trans = $1; + $attach = $2; + } + else { + Abort("Corrupted attachment URL."); + } + my $AttachmentObj = new RT::Attachment($session{'CurrentUser'}); + $AttachmentObj->Load($attach) || Abort("Attachment '$attach' could not be loaded"); + + + unless ($AttachmentObj->id) { + Abort("Bad attachment id. Couldn't find attachment '$attach'\n"); + } + unless ($AttachmentObj->TransactionId() == $trans ) { + Abort("Bad transaction number for attachment. $trans should be".$AttachmentObj->TransactionId() ."\n"); + + } + my $content_type = $AttachmentObj->ContentType || 'text/plain'; + SetContentType($content_type); + $m->out($AttachmentObj->Content); + $m->abort; +</%perl> + |