import rt 3.4.6
[freeside.git] / rt / html / NoAuth / images / autohandler
index 7209798..2e428c1 100644 (file)
@@ -1,28 +1,24 @@
-<%INIT>
-&RT::Interface::Web::StaticFileHeaders();
+<%init>
 
 # This autohandler will spit out RT's images if the user hasn't 
 # properly configured their webserver to stop RT from passing 
 # images through the mason handler.
-my $file = $m->base_comp->source_file;
-
 
+my $file = $m->base_comp->source_file;
 my $type = "application/octet-stream";
+
 if ($file =~ /\.(gif|png|jpe?g)$/i) {
     $type = "image/$1";
     $type =~ s/jpg/jpeg/gi;
 }
 
-die "file not found" unless -f $file && -r _;
-
+die unless (-f $file && -r $file);
 $r->content_type($type);
-open my $fh, "<$file" or die "couldn't open file: $!";
-binmode($fh);
+open (FILE, "<$file") || die;
 {
     local $/ = \16384;
-    $m->out($_) while (<$fh>);
-    $m->flush_buffer;
+    $m->out($_) while (<FILE>);
+    close(FILE);
 }
-close $fh;
 $m->abort;
-</%INIT>
+</%init>