summaryrefslogtreecommitdiff
path: root/rt/html/NoAuth/images/autohandler
diff options
context:
space:
mode:
authorivan <ivan>2008-03-02 04:11:51 +0000
committerivan <ivan>2008-03-02 04:11:51 +0000
commit8103c1fc1b2c27a6855feadf26f91b980a54bc52 (patch)
tree631dd45606c37c00d9026e14ecc3ee3700b4b51c /rt/html/NoAuth/images/autohandler
parent9c68254528b6f2c7d8c1921b452fa56064783782 (diff)
import rt 3.6.6
Diffstat (limited to 'rt/html/NoAuth/images/autohandler')
-rw-r--r--rt/html/NoAuth/images/autohandler20
1 files changed, 12 insertions, 8 deletions
diff --git a/rt/html/NoAuth/images/autohandler b/rt/html/NoAuth/images/autohandler
index 2e428c1..7209798 100644
--- a/rt/html/NoAuth/images/autohandler
+++ b/rt/html/NoAuth/images/autohandler
@@ -1,24 +1,28 @@
-<%init>
+<%INIT>
+&RT::Interface::Web::StaticFileHeaders();
# 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 $type = "application/octet-stream";
+
+my $type = "application/octet-stream";
if ($file =~ /\.(gif|png|jpe?g)$/i) {
$type = "image/$1";
$type =~ s/jpg/jpeg/gi;
}
-die unless (-f $file && -r $file);
+die "file not found" unless -f $file && -r _;
+
$r->content_type($type);
-open (FILE, "<$file") || die;
+open my $fh, "<$file" or die "couldn't open file: $!";
+binmode($fh);
{
local $/ = \16384;
- $m->out($_) while (<FILE>);
- close(FILE);
+ $m->out($_) while (<$fh>);
+ $m->flush_buffer;
}
+close $fh;
$m->abort;
-</%init>
+</%INIT>