diff options
author | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
commit | ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 (patch) | |
tree | a2ea500cf510739908761a6bfbd14e990131f2cc /rt/html/NoAuth/images/autohandler | |
parent | a513c0bef534d05f03c1242831b6f3be19b97dae (diff) |
import rt 3.6.4
Diffstat (limited to 'rt/html/NoAuth/images/autohandler')
-rw-r--r-- | rt/html/NoAuth/images/autohandler | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/rt/html/NoAuth/images/autohandler b/rt/html/NoAuth/images/autohandler index 2e428c157..720979830 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> |