RT 4.0.13
[freeside.git] / rt / share / html / REST / 1.0 / ticket / comment
index 768a468..475e3a8 100755 (executable)
@@ -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 %>