]> git.uio.no Git - usit-rt.git/blobdiff - share/html/REST/1.0/ticket/comment
Dev to 4.0.11
[usit-rt.git] / share / html / REST / 1.0 / ticket / comment
index 768a4688b5c4cfa43b1f5545e98680e2fa92ca4a..475e3a88db89b9feed5bacb305ee2299a56a54f5 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -55,6 +55,7 @@ use MIME::Entity;
 use LWP::MediaTypes;
 use RT::Interface::REST;
 use File::Temp qw(tempfile);
+my @tmp_files;
 
 my $ticket = RT::Ticket->new($session{CurrentUser});
 my $object = $r->path_info;
@@ -106,7 +107,10 @@ if (!$k->{Text} && @atts == 0) {
 }
 
 my $cgi = $m->cgi_object;
-my $ent = MIME::Entity->build(Type => "multipart/mixed");
+my $ent = MIME::Entity->build(
+    Type => "multipart/mixed",
+    'X-RT-Interface' => 'REST',
+);
 $ent->attach(Data => $k->{Text}) if $k->{Text};
 
 my $i = 1;
@@ -119,6 +123,7 @@ foreach my $att (@atts) {
     if ($fh) {
         my $buf;
         my ($w, $tmp) = tempfile();
+        push @tmp_files, $tmp;
         my $info = $cgi->uploadInfo();
 
         while (sysread($fh, $buf, 8192)) {
@@ -171,6 +176,8 @@ if ($k->{Status}) {
 }
 
 OUTPUT:
+
+unlink @tmp_files;
 </%INIT>
 RT/<% $RT::VERSION %> <% $status %>